Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx015.isp.belgacom.be (inmx015.isp.belgacom.be [195.238.2.218])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id iB7D2GsN023825
        for <joris.at.lebbeke@skynet.be>; Tue, 7 Dec 2004 14:02:16 +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 inmx015.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id iB7D24c7017474
        for <joris.at.lebbeke@skynet.be>; Tue, 7 Dec 2004 14:02:06 +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 DDBEA4E02F2; Tue,  7 Dec 2004 08:01:50 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx016.isp.belgacom.be (outmx016.isp.belgacom.be
	[195.238.2.115])
	by xserve.flids.com (Postfix) with ESMTP id C48454E02CC
	for <tiff@remotesensing.org>; Tue,  7 Dec 2004 08:01:47 -0500 (EST)
Received: from outmx016.isp.belgacom.be (localhost [127.0.0.1])
	by outmx016.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id iB7D1kGF014754
	for <tiff@remotesensing.org>; Tue, 7 Dec 2004 14:01:46 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (221-175.245.81.adsl.skynet.be [81.245.175.221])
	by outmx016.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id iB7D1cLZ014691; Tue, 7 Dec 2004 14:01:38 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <001501c4dc5c$f8c812a0$ddaff551@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Dan Field" <dof@llgc.org.uk>, <tiff@remotesensing.org>
References: <41B5A137.1030103@llgc.org.uk><000701c4dc50$6d6c6050$ddaff551@dfgrrxsknr4e><41B5A448.9070609@llgc.org.uk><000b01c4dc52$ad0e21b0$ddaff551@dfgrrxsknr4e>
	<41B5A8BD.5080203@llgc.org.uk>
Subject: Re: [Tiff] Fetching pixel data from 4bit tiff
Date: Tue, 7 Dec 2004 14:02:11 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Cc: 
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: 035c5d6f06a02f51661e460da5dfdb27

> R=(unsigned char)TIFFGetR(raster+i);
> G=(unsigned char)TIFFGetG(raster+i);
> B=(unsigned char)TIFFGetB(raster+i);
> A=(unsigned char)TIFFGetA(raster+i);

There's another error here, sorry I didn't spot that one earlier. TIFFGetR and
the like don't take an address of a 32bit RGBA value, but the RGBA value itself.
So you should actually be doing

uint32 rgba;
rgba=*(uint32*)(raster+i);  // or something along these lines, C invokes instant
dyslexia over here
R=(unsigned char)TIFFGetR(rgba);
G=(unsigned char)TIFFGetG(rgba);
B=(unsigned char)TIFFGetB(rgba);
A=(unsigned char)TIFFGetA(rgba);



Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html

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