Return-Path: owner-tiff@olympiakos.com
Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (localhost [127.0.0.1])
	by at1895.spb.edu (8.12.1/8.12.1/Debian -5) with ESMTP id g2PNRU7r026386
	for <dron@localhost>; Tue, 26 Mar 2002 02:27:44 +0300
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.9.0)
	for dron@localhost (single-drop); Tue, 26 Mar 2002 02:27:44 +0300 (MSK)
Received: from gate7.olympiakos.com ([64.32.199.150]) by shared1-mail.whowhere.com; Mon Mar 25 11:38:53 2002
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id OAA13577;
	Mon, 25 Mar 2002 14:23:52 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Mon, 25 Mar 2002 14:20:42 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id OAA13553
	for tiff-outgoing; Mon, 25 Mar 2002 14:20:41 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from adobe.com (smtp-relay-1.adobe.com [192.150.11.1])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id OAA13550
	for <tiff@olympiakos.com>; Mon, 25 Mar 2002 14:20:40 -0500
Received: from inner-relay-1.corp.adobe.com ([153.32.1.51])
	by adobe.com (1.0.0/8.11.4) with ESMTP id g2PJLpi15782
	for <tiff@olympiakos.com>; Mon, 25 Mar 2002 11:21:51 -0800 (PST)
Received: from mailsj-v1.corp.adobe.com (mailsj-dev.corp.adobe.com [153.32.1.192])
	by inner-relay-1.corp.adobe.com (8.11.4/8.11.4) with ESMTP id g2PJKVq27416
	for <tiff@olympiakos.com>; Mon, 25 Mar 2002 11:20:31 -0800 (PST)
Received: from [153.32.48.223] ([153.32.48.223]) by
          mailsj-v1.corp.adobe.com (Netscape Messaging Server 4.15 v1 Jul
          11 2001 16:32:57) with ESMTP id GTJN1G00.259; Mon, 25 Mar 2002
          11:20:04 -0800 
Mime-Version: 1.0
X-Sender: ccox@mailsj.corp.adobe.com
Message-Id: <p04320403b8c527654d19@[153.32.48.223]>
In-Reply-To: <3C9F6E66.5080901@3dnature.com>
References: <3C9F6E66.5080901@3dnature.com>
Date: Mon, 25 Mar 2002 11:20:03 -0800
To: xenon@3dnature.com, tiff@olympiakos.com
From: Chris Cox <ccox@adobe.com>
Subject: Re: Photoshop TIFF+Alpha mysteries
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 3548
Lines: 84

First - you are confusing transparency with alpha channels.

Alpha channels are a superset:  they can be many things, only ONE of 
which is transparency.
A transparency channel is a subset of possible alpha channels (one 
which is associated with the image data).


At 11:37 AM -0700 3/25/02, Chris 'Xenon' Hanson wrote:
>   Maybe this is an FAQ.
>
>   We use LIBTIFF in our software, and I am forever grateful for the brain
>aneurysms it has prevented for me.
>
>   In several places in our software we support the use of an Alpha channel
>to indicate transparency amounts when compositing various images together.
>
>   For example, I use Photoshop 5.5 to open a vector-based logo file I have
>lying around. I set RGB Color, and anti-aliased. It converts it to a raster
>image with transparency (but no Alpha channel). Fine.

Just save as TIFF, there is no need to add an alpha channel or 
flatten - because you already have transparency.


>   Now, I do Select/Load Selection, choose Layer 1 Transparency and New
>Selection. Now, Select/Save Selection, New Channel, named "Alpha". Now
>I flatten the image.
>
>   Ok. I appear to have an Alpha channel. Here I can do one of two things.
>
>   I can save it as a 32-bit Targa file or I can save it as a TIFF file.

In Photoshop 5.x, Targa used alpha channels instead of transparency.
Thus it's using your blank alpha channel for the Targa file.


>   If I save it as Targa, it works fine in my app. The NULL areas where there
>was no logo are interpreted as transparent.
>
>   If I save it as TIFF, it doesn't exactly work. The areas that are
>transparent in the TGA are opaque.

Because you flattened the image and added an alpha channel.
Lord only knows what your software is actually reading for the transparency.


>  A few pixels along the border between
>the logo and the background area appear to become transparent.
>
>   Loading the working TGA file back into Photoshop and resaving it as a TIFF
>appears to make a similarly non-working TIFF. Resaving the non-working TIFF
>as a 32-bit TGA makes a working TGA file.
>
>   So, the actual Alpha 'channel' data in Photoshop is presumably identical
>in all of the images. Perhaps Photoshop interprets that Alpha channel data
>as it loads/saves to TIFF? Perhaps LIBTIFF is interpreting that Alpha channel
>data differently as I load it? I'm not sure. All I know is that from the API
>side of things, I have all indications that there is an alpha channel in the
>TIFF image I load, yet when I go to use it in the way I am accustomed to, it
>doesn't work the way i expect. I expect I'm missing some small detail.

Yep - you're confused.


>   I've been thinking my next step is to add a a bit of debugging code to my
>LIBTIFF loader to write the alpha channel out to a raw file so I may examine
>it and see what exactly I'm getting out of LIBTIFF. However, I suspect this
>is already a commonly-encountered problem and someone can just point me at
>an answer I have overlooked.
>
>   I considered that it might be an difference of premultipled versus non
>premultipled alpha, but since the image data itself is the same, I can't see
>how this could be.

There is no transparency in your TIFF image - because you flattened the image.
If there was transparency, then the TIFF would have an associated 
alpha channel and the color data would be premultiplied with white 
(white matted).

Chris

To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org

