GNOME Bugzilla – Bug 131030
tiff plugin always assumes premuliplied alpha, doesn't honor EXTRASAMPLES
Last modified: 2004-01-16 21:29:08 UTC
Currently the tiff plugin violates the tiff specification, by always assuming premultiplied alpha. Even if the EXTRASAMPLES tag explicitly states otherwise. EXTRASAMPLES specifies if RGB or Grayvalue are premultiplied with the alpha channel. See the current tiff spec, available at http://partners.adobe.com/ asn/developer/PDFS/TN/TIFF6.pdf page 31,32 and 77 for more information. The following patch enables gimp to read unassociated extra channels properly. Contrary to the current coding style, I used the libtiff types when calling libtiff functions, as sven@gimp.org suggested. At least for the code that relates to the EXTRASAMPLES tag. It still saves premultiplied alpha, but it should be easy to add an gui option to allow the user to choose unassociated alpha (I'm not familar with gtk, so I won't try).
Created attachment 23177 [details] [review] patch, first try
This is not quite a duplicate, but it is related to bug #82882, which has a patch to prevent pre-multiplication of alpha data. http://bugzilla.gnome.org/show_bug.cgi?id=82882 Thanks for the patches, Pablo :) Cheers, Dave.
The GUI for this should be similar to that used for the png plug-in, as described in bug #129472, which has a patch attached. Adding PATCH keyword, and setting milestone to 2.0. Dave.
Yes, its related to bug #82882, but it actually handles both premultiplied and not premultiplied data correctly. Sorry, I wont add the GUI and change the PDB interface, I simply do not have the time to learn all this and provide a 100% foolproof solution. For me, the most important thing is that gimp supports reading the tif files written by my panorama stitcher, nona, and that I can properly rearrange the alpha channels to adjust the seams between the different images after they have been combined. Originally I wanted to save xcf, but since its a private format...
I'll finish the GUI on this, should be fairly trivial. Dave.
Patch applied (modified) in CVS. I used a gboolean save value to indicate saving transparent pixels (same as png), and used that throughout. 2004-01-16 Dave Neary <bolsh@gimp.org> * plug-ins/common/tiff.c: Apply a (modified) patch from Pablo d'Angelo to enable saving of a non-premultiplied alpha channel and provide an UI to use it (a checkbox and extra PDB procedure). Fixes bug #131030.