AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
August 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2007.08.06 22:08 "Transparency ... associated or unassociated alpha is more compatible?", by William Gallafent
2007.08.06 22:27 "Re: Transparency ... associated or unassociated alpha is more compatible?", by Bob Friesenhahn
2007.08.06 22:28 "Re: Transparency ... associated or unassociated alpha is morecompatible?", by Chris Cox
2007.08.06 22:32 "Re: Transparency ... associated or unassociated alpha is morecompatible?", by Chris Cox
2007.08.06 22:48 "Re: Transparency ... associated or unassociated alpha is morecompatible?", by Bob Friesenhahn
2007.08.06 22:48 "Re: Transparency ... associated or unassociated alpha is morecompatible?", by Chris Cox

2007.08.06 22:08 "Transparency ... associated or unassociated alpha is more compatible?", by William Gallafent

Hi,

I'm experimenting with TIFF export for RGBA images, bit depth 
eight and sixteen. I need to decide which style of alpha 
channel to use in order to maximise interoperability with other 
applications, and my experiments so far have been inconclusive. 
I'm using LibTIFF to do the exporting. I set the following 
fields:

SAMPLESPERPIXEL: 4.
EXTRASAMPLES: count = 1, value = EXTRASAMPLE_ASSOCALPHA or 
EXTRASAMPLE_UNASSALPHA.
PHOTOMETRIC: PHOTOMETRIC_RGB.

If I "apply" the alpha channel (multiplying the colour channels 
before saving), and then save the test image with associated 
(premultiplied) alpha flag set for the extra channel, it loads 
correctly in to Photoshop CS3, Acrobat Professional and Apple's 
iPhoto, for example. Apple's Preview, and Safari, though, do 
not load it correctly, having very wrong-looking results where 
the A channel is not 0 or 255 (or 65535 for bit depth 16).

If, on the other hand, I leave the RGB channels at full range, 
and set the flag for unassociated alpha, I get a result which 
displays correctly in Apple's Preview, and in Safari. In 
Photoshop CS3, on the other hand, the transparency is loaded as 
a separate alpha channel, and it seems that several steps of 
fiddling must be done in order to apply it and to make it act 
as the image's transparency channel, as intended.

Apple's iPhoto is the only program I've found which makes a 
nice-looking result on loading either type without tweaking 
post-load!

So, which is the preferred format in general? Am I right when I 
suggest that Adobe's tools seem to prefer associated / 
premultiplied, and Apple's unassociated? It seems clear from 
the spec that in this application (the alpha channel is a 
transparency matte for the foreground object in the image) 
premultiplied should be the way to go, but if e.g. Apple's 
tools do not handle such files correctly, and do work with 
unassociated, then that must be the preferred choice for my 
application, iff it can be made simple for Photoshop users to 
achieve their desired result too.

Perhaps there is something wrong with or missing from one or 
other (or both!) of my output files, which Photoshop is able to 
cope with in the premultiplied case, and Apple's tools not? For 
example, I wondered if I should set something such as 
PHOTOMETRIC_MINISBLACK or PHOTOMETRIC_MINISWHITE to hint 
further regarding the meaning of the associated alpha channel, 
but I couldn't see how to make these apply at the same time as 
the truthful PHOTOMETRIC_RGB of the non-"extra" channels. Or is 
there a way to make Photoshop load the unassociated file and 
trivially use the alpha channel as the transparency mask for 
the image?

I can post a couple of very small (below 5KB compressed) sample 
files to the list (one associated, the other unassociated, as 
created by my code), if anybody is interested and nobody 
objects.

Thanks for any advice,

-- 
Bill Gallafent.