Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx009.isp.belgacom.be (inmx009.isp.belgacom.be [195.238.3.146])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j2B9Hxb6029985
        for <joris.at.lebbeke@skynet.be>; Fri, 11 Mar 2005 10:17:59 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx009.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j2B9Hp0Q010696
        for <joris.at.lebbeke@skynet.be>; Fri, 11 Mar 2005 10:17:52 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 6620712564D4; Fri, 11 Mar 2005 04:17:33 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from ms-dienst.rz.rwth-aachen.de (ms-2.rz.rwth-aachen.de
	[134.130.3.131])
	by xserve.flids.com (Postfix) with ESMTP id E6FC212564B1
	for <tiff@remotesensing.org>; Fri, 11 Mar 2005 04:17:31 -0500 (EST)
Received: from r220-1 (r220-1.rz.RWTH-Aachen.DE [134.130.3.31])
	by ms-dienst.rz.rwth-aachen.de
	(iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003))
	with ESMTP id <0ID600LCLKH6VV@ms-dienst.rz.rwth-aachen.de> for
	tiff@remotesensing.org; Fri, 11 Mar 2005 10:17:31 +0100 (MET)
Received: from relay.rwth-aachen.de ([134.130.3.1])
	by r220-1 (MailMonitor for SMTP v1.2.2 ) ; Fri,
	11 Mar 2005 10:17:30 +0100 (MET)
Received: from mail.hilton.rwth-aachen.de
	(mail.hilton.RWTH-Aachen.DE [134.130.55.29])
	by relay.rwth-aachen.de (8.13.3/8.13.3/1) with ESMTP id
	j2B9HUqD011110	for
	<tiff@remotesensing.org>; Fri, 11 Mar 2005 10:17:30 +0100 (MET)
Received: by mail.hilton.rwth-aachen.de (Postfix, from userid 1000)
	id 131886BCA2; Fri, 11 Mar 2005 10:17:25 +0100 (CET)
Date: Fri, 11 Mar 2005 10:17:25 +0100
From: sievers@hilton.rwth-aachen.de
In-reply-to: <42302576.4080306@hilton.rwth-aachen.de>
To: tiff@remotesensing.org
Message-id: <20050311091725.131886BCA2@mail.hilton.rwth-aachen.de>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8; format=flowed
Content-transfer-encoding: 7BIT
References: <42302576.4080306@hilton.rwth-aachen.de>
Subject: [Tiff] Re: libtiff: Tiff Tag EXTRASAMPLES and TIFFRGBAImage
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 15a916f8c8802970d8ed0667f66aa5c9

To make it more obvious why this seems strange: 

In the code below, it is checked for extrasamples>1,
but then the only item considered is sampleinfo[0]. 

For the case extrasamples==1 (the common case), img->alpha is never changed 
from the original initialization to 0. (Therefore later the alpha channel 
from the file is ignored.) 

   if (extrasamples > 1)
   {
	switch (sampleinfo[0]) {
	case EXTRASAMPLE_UNSPECIFIED:	
		if (img->samplesperpixel > 3)
			img->alpha = EXTRASAMPLE_ASSOCALPHA;
		break;
	case EXTRASAMPLE_ASSOCALPHA:	/* data is pre-multiplied */
	case EXTRASAMPLE_UNASSALPHA:	/* data is not pre-multiplied */
		img->alpha = sampleinfo[0];
		break;
	}
   } 

 

 

> 1) Reading TIFF images with the nice TIFFReadRGBAImage() routine 
> 
> (version of libtiff used is 3.7.1 ) 
> 
> in line 250 of tif_getimage.c it says:
> "if (extrasamples > 1)" 
> 
> That way img->alpha is always left set to 0 for images with
> extrasamples==1 (which I assume is the common case). Then alpha values
> from the image are not used, but initialized to 0xff. 
> 
> Shouldn't it say "if (extrasamples > 0)"? 
> 
> ~From what I can see with common code samples and RGB images, these have
> a value of extrasamples==1, if they contain an alpha channel. 
> 
 


_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
