Received: from mailgate012.isp.belgacom.be (mailgate012.isp.belgacom.be [195.238.6.5])
	by maildelivery017.isp.belgacom.be (Postfix) with ESMTP id 1DF02C03E
	for <joris.at.lebbeke@skynet.be>; Tue,  7 Aug 2007 00:42:14 +0200 (CEST)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 07 Aug 2007 00:42:13 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l76MX0jG031719;
	Mon, 6 Aug 2007 18:33:06 -0400
Received: from exprod6og51.obsmtp.com (exprod6og51.obsmtp.com [64.18.1.183])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l76MWif5031713
	for <tiff@lists.maptools.org>; Mon, 6 Aug 2007 18:32:45 -0400
Received: from source ([192.150.11.134]) by exprod6ob51.postini.com
	([64.18.5.12]) with SMTP; Mon, 06 Aug 2007 15:32:32 PDT
Received: from inner-relay-3.eur.adobe.com (inner-relay-3.adobe.com
	[192.150.20.198] (may be forged))
	by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id
	l76MV3ot011180; Mon, 6 Aug 2007 15:31:07 -0700 (PDT)
Received: from fe2.corp.adobe.com (fe2.corp.adobe.com [10.8.192.72])
	by inner-relay-3.eur.adobe.com (8.12.10/8.12.9) with ESMTP id
	l76MWO0e004730; Mon, 6 Aug 2007 15:32:25 -0700 (PDT)
Received: from namail3.corp.adobe.com ([10.8.192.66]) by fe2.corp.adobe.com
	with Microsoft SMTPSVC(6.0.3790.1830); 
	Mon, 6 Aug 2007 15:32:25 -0700
x-mimeole: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: RE: [Tiff] Transparency ... associated or unassociated alpha is
	morecompatible?
Date: Mon, 6 Aug 2007 15:28:52 -0700
Message-ID: <3B96007137B4CE4E85114278E640DC330131C768@namail3.corp.adobe.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [Tiff] Transparency ... associated or unassociated alpha is
	morecompatible?
Thread-Index: AcfYdo8EwUyJ2teISJecEBwH4fSlVAAApvyp
References: <200708062308.33958.william@gallaf.net>
From: "Chris Cox" <ccox@adobe.com>
To: "William Gallafent" <william@gallaf.net>, <tiff@lists.maptools.org>
X-OriginalArrivalTime: 06 Aug 2007 22:32:25.0377 (UTC)
	FILETIME=[A9BDA910:01C7D879]
X-MIME-Autoconverted: from quoted-printable to 8bit by duke.maptools.org id
	l76MWif5031713
Cc: 
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
Content-Transfer-Encoding: quoted-printable
X-UIDL: 000000000023ceae.000026e2
X-MSP-STORE: Tue, 07 Aug 2007 00:42:14 --21-99
Status:   

If you want transparency, keep it as associated alpha and premultiply acc=
ording to the spec.

Then file a bug against Apple's TIFF code because someone at Apple failed=
 to read the TIFF spec....
If a channel is marked unassociated, loading it as transparency is also a=
 bug -- because the file says it is NOT transparency.

It sounds like there is nothing wrong with your files, but Apple has some=
 bugs to fix (as do some other software and hardware vendors).

Chris




-----Original Message-----
From: tiff-bounces@lists.maptools.org on behalf of William Gallafent
Sent: Mon 8/6/2007 3:08 PM
To: tiff@lists.maptools.org
Subject: [Tiff] Transparency ... associated or unassociated alpha is more=
compatible?
=20
Hi,

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

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

If I "apply" the alpha channel (multiplying the colour channels=20
before saving), and then save the test image with associated=20
(premultiplied) alpha flag set for the extra channel, it loads=20
correctly in to Photoshop CS3, Acrobat Professional and Apple's=20
iPhoto, for example. Apple's Preview, and Safari, though, do=20
not load it correctly, having very wrong-looking results where=20
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,=20
and set the flag for unassociated alpha, I get a result which=20
displays correctly in Apple's Preview, and in Safari. In=20
Photoshop CS3, on the other hand, the transparency is loaded as=20
a separate alpha channel, and it seems that several steps of=20
fiddling must be done in order to apply it and to make it act=20
as the image's transparency channel, as intended.

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

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

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

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

Thanks for any advice,

--=20
Bill Gallafent.
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
