TIFF can optionally have pre-multiplied alpha and it depends on the exporting software if it is used or not. The flag is stored somewhere inside TIFF and is not exported to FreeImage directly :(
Read more about the flag here: https://www.awaresystems.be/imaging/tiff/tifftags/extrasamples.html
If the flag is 1 (EXTRASAMPLE_ASSOCALPHA) - the alpha is premultiplied, if it is 2 (EXTRASAMPLE_UNASSOCALPHA) - it is not. FreeImage always stores non-premultiplied alpha, Photoshop stores pre-multiplied one, so we need a method to check this. The image loading code should be able to find "ExtraSamples" tag in FreeImage object for semi-transparent TIFF images to decide on the alpha, but the problem is that FreeImage doesn't read that tag and doesn't add it to the list, so it needs to be updated for that here.
What needs to be added is just a single line:
{ 0x0152, (char *) "ExtraSamples", (char *) "Description of extra components"},
The line needs to be added to the exif_exif_tag_table array in Source/Metadata/TagLib.cpp file.
Thank you.
Anonymous
Yes, I confirm that Tag 0x152 is missing in FreeImage's listing. Attached are two screenshots, while one is showing the existence of such a tag, the other being by FreeImage does not show it in EXIF.
Last edit: Johnny Petersen 2019-02-26
Hi,
Thanks for the patch, it is now available in the SVN ( https://sourceforge.net/p/freeimage/svn/HEAD/tree/FreeImage/trunk/ ) and will be available in the next FreeImage release.
Best regards,
Hervé
Ticket moved from /p/freeimage/bugs/289/