After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 66886 - Add support for multiple page TIFF images
Add support for multiple page TIFF images
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: High enhancement
: Future
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2001-12-13 16:54 UTC by Bryce Nesbitt
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch to load multipage TIFF (21.10 KB, patch)
2003-11-30 11:03 UTC, Andrey Kiselev
none Details | Review
updated patch (30.27 KB, patch)
2003-12-02 11:04 UTC, Sven Neumann
none Details | Review
Added support for non-premultiplied alpha channels, and layer offsets (22.99 KB, patch)
2004-01-08 16:59 UTC, Bruno Postle
none Details | Review

Description Bryce Nesbitt 2001-12-13 16:54:41 UTC
http://www.efax.com/ sends out multiple page .tiff files.
As far as I can tell, gimp can view only the first page of these.
It would be nice to see the rest.
Comment 1 Raphaël Quinet 2001-12-14 15:37:53 UTC
The multiple pages could be loaded (and saved) as separate layers.
Comment 2 rnolde 2003-05-21 14:01:21 UTC
Multipage TIFFS are supported by the standard libtiff utiltites,
available for almost all *nix and even Win32, and can be viewed
with the GNU HaliFAX viewer, so the code to handle them is out
there.  A short term solution is to use tiffsplit to break the
multipage image into single pages and edit them one at a time.
However, the GIMP's 1 bit per pixel black and white palette option
does not create a true BILEVEL image as needed by Group 3/4 Fax
for multipage TIFFs.  G3/4 faxes are highly compressed as runs
of 0s and 1s, rather than individual bytes containing only 0 or 1
values.  It would be nice to have an option to export true BILEVEL
TIFFs, even as single pages, and this would be part of the
solution to your request to load multiplage TIFFs too.

  Richard Nolde
   rnolde@ltgc.com
Comment 3 Alan Horkan 2003-07-23 18:40:10 UTC
Changes at the request of Dave Neary on the developer mailing list.  
I am changing many of the bugzilla reports that have not specified a target
milestone to Future milestone.  Hope that is acceptable.  
Comment 4 Sven Neumann 2003-10-27 23:14:10 UTC
If libtiff supports this, I suspect that this should be relatively
easy to implement. If someone who knows the libtiff library better
than me can back this up, please add the "easy-fix" keyword.

Raising priority since this is a frequently requested feature.
Comment 5 Andrey Kiselev 2003-11-30 10:55:58 UTC
There is a patch against tiff.c plug-in to add ability to load
multipage TIFF as an image with sevearl layers. I'm not fluent with
GIMP plug-in API, so I don't know how to save the multilayer file in
form of multipage TIFF, likely I shall try to figure out how it may be
done and prepare additional patch.

There are a few lines of new code only, but patch looks long because
of tabulation changes: the large block of the code goes into loop
brackets.

You can prepare multipage TIFF for testing with the tiffcp utility:

$ tiffcp in1.tiff in2.tiff ... out.tif

Comment 6 Andrey Kiselev 2003-11-30 11:03:37 UTC
Created attachment 21935 [details] [review]
Patch to load multipage TIFF
Comment 7 Sven Neumann 2003-11-30 13:59:20 UTC
Looks good from a quick glimpse at the patch. Perhaps I can later
today find the time to review the patch more thoroughly.
Comment 8 Sven Neumann 2003-12-02 11:04:36 UTC
Created attachment 22006 [details] [review]
updated patch
Comment 9 Sven Neumann 2003-12-02 11:05:19 UTC
There were a few minor problems that I tried to address. For example,
GIMP wants you to add an alpha channel to all layers but the
Background layer. I tried to address these issues. My new patch also
contains some more code cleanup in the tiff plug-in. I would
appreciate some testing before I commit this.
Comment 10 Sven Neumann 2003-12-02 22:31:41 UTC
I'm committing this change because I believe it is correct but needs
testing. The only way to get it tested is to get it out to the people.
If this change breaks the plug-in, it should be backed out and
postponed until after the 2.0 release.

2003-12-02  Sven Neumann  <sven@gimp.org>

   * plug-ins/common/tiff.c: applied a modified version of a patch
   submitted by Andrey Kiselev. Implements loading of TIFF files with
   multiple pages (bug #66886).
Comment 11 Ed Halley 2004-01-06 23:48:58 UTC
Adding a searchable comment to this bug.

Several panorama stitching tools based on the 'panotools' library also
support multiple-image "layered" tiff formats.  Note that like xcf,
the tiff layers do not need to have the same bounds as the full image
area.

It looks like this is not active in the 1.3.23 .rpm I have, so I won't
reopen this unless it doesn't appear to work in the 1.3.24 or so.
Comment 12 Bruno Postle 2004-01-07 14:37:35 UTC
Multi-page tiff files now are loading here (gimp-2 pre1).  There
are some remaining issues:

Layer offsets are ignored, all layers are placed at the top left.

The canvas is sized to the dimensions of the bottom layer.

Layer masks are loaded as alpha channels rather than masks.  This
loses information where transparency is 100%.                        
        
Comment 13 Bruno Postle 2004-01-08 16:59:21 UTC
Created attachment 23116 [details] [review]
Added support for non-premultiplied alpha channels, and layer offsets
Comment 14 Bruno Postle 2004-01-08 17:16:35 UTC
I uploaded a patch to tiff.c by Pablo D'Angelo.  This
adds support for reading layer offsets in tiff files and
for reading non-premultiplied alpha channels properly.

Tested ok on a photoshop6 (single layer) tiff file, a
multi-layer FAX format tiff file and various tiff files
generated by hugin/nona.
Comment 15 Sven Neumann 2004-01-08 18:22:29 UTC
This looks good (except some style issues and // comments). However I
think that while the fix for layer offsets should be applied before
2.0, the masks patch should wait until 2.0.1 or 2.2 (that would have
to be decided still).

It would be very much appreciated if you could open two new bug
reports. One about layer offsets in multi-page TIFF files, the other
about the mask fix. Please attach the patch there then. Or, and that
would be very nice, create individual patches for each bug report.
Comment 16 Pablo d'Angelo 2004-01-08 23:19:35 UTC
About the alpha channel stuff. Currently the tiff plugin violates  
the tiff specification, by always assuming premultiplied alpha, even 
if the tiff file explicitly states otherwise. 
 
Maybe the current behaviour while saving might be expected by some 
people (although I would rate it counterintitive). 
 
However, I expect that valid tiff files should be read properly. 
Or are there important tiff writers that save the alpha channel in a 
way that does not confirm to the TIFF spec? 
 
See the current tiff spec, available at http://partners.adobe.com/
asn/developer/PDFS/TN/TIFF6.pdf page 31,32 and 77 
 
Pablo d'Angelo 
Comment 17 Sven Neumann 2004-01-08 23:49:23 UTC
It would really help us a lot if you could file two bug reports for
these two issues.
Comment 18 Sven Neumann 2004-01-09 19:21:06 UTC
New reports have been opened as bug #131016 and bug #131030.