Return-Path: <tiff-bounces@lists.maptools.org>
Received: from infbas001.isp.belgacom.be (localhost [127.0.0.1])
        by inav013.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id l0VImwUD023116
        for <joris.at.lebbeke@skynet.be>; Wed, 31 Jan 2007 19:48:58 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inas023.isp.belgacom.be (inas023.isp.belgacom.be [195.238.4.229])
        by infbas001.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id l0VImv0H004604
        for <joris.at.lebbeke@skynet.be>; Wed, 31 Jan 2007 19:48:57 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx018.isp.belgacom.be (inmx018.isp.belgacom.be [195.238.4.79])
        by inas023.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id l0VImr3L001181
        for <joris.at.lebbeke@skynet.be>; Wed, 31 Jan 2007 19:48:54 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org ([209.217.116.153])
        by inmx018.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id l0VImhN8014735
        for <joris.at.lebbeke@skynet.be>; Wed, 31 Jan 2007 19:48:43 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
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 l0VHW80G030863;
	Wed, 31 Jan 2007 12:32:14 -0500
Received: from outmx004.isp.belgacom.be (outmx004.isp.belgacom.be
	[195.238.4.101])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l0VHW6is030860
	for <tiff@lists.maptools.org>; Wed, 31 Jan 2007 12:32:07 -0500
Received: from outmx004.isp.belgacom.be (localhost [127.0.0.1])
	by outmx004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22)
	with ESMTP id l0VHW0De003844
	for <tiff@lists.maptools.org>; Wed, 31 Jan 2007 18:32:02 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from AWareCore2Duo (172.160-241-81.adsl-dyn.isp.belgacom.be
	[81.241.160.172])
	by outmx004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22)
	with SMTP id l0VHVrhQ003755; Wed, 31 Jan 2007 18:31:53 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <002c01c7455d$b1d415d0$a100a8c0@AWareCore2Duo>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Reinhard Mayr aka Czerwinski" <czerwinski1977@gmx.net>,
        <tiff@lists.maptools.org>
References: <20070131163904.36820@gmx.net>
Subject: Re: [Tiff] 16bit grayscale with colormap
Date: Wed, 31 Jan 2007 18:31:46 +0100
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.3028
x-mimeole: Produced By Microsoft MimeOLE V6.00.2900.3028
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
X-UIDL: 000000000023ceae.00002054
X-MSP-STORE: Wed, 31 Jan 2007 19:49:01 +0100
Status: RO

Reinhard,

Reinhard Mayr aka Czerwinski wrote:
> I deal with 16bit grayscale TIFFs. The files originate from a 12bit
> CCD, so the linear conversion 16bit->8bit turns my image almost
> black.

You can write 12bit grayscale. It is perfectly legit TIFF. However, few 
readers will support it. You can also rescale to a more common bitdepth, 
like 8bit or 16bit, before writing.

> To cope with that, I would like to add a ColorMap into the TIFF. For
> testing, I altered an existing 16bit file:
> o photometrics = 3 (ColorMap)
> o added a colormap (tag 0140), length: 3*2^16= 196608 bytes

You mean 3*2^16 words, not bytes. Palettes (Colormaps) in TIFF are 3 word 
values per palette entry.

> Is this a proper interpretation of the TIFF specs (TIFF6 specs p.23
> allow only 4/8 bits per sample -- why?)?

Yes it is  a proper interpretation of the TIFF spec. The pages you refer to, 
are *baseline* TIFF. The whole concept of baseline TIFF is a bit dated, as 
many flavours that aren't originally regarded baseline are commonly 
supported these days. But in any case, even originally, there wasn't a 
restriction to 4 or 8 bits per sample in Colormap TIFFs as long as you know 
they're not baseline.

In general, TIFF is extremely flexible this way. You can have a 21 bit 
Colormap TIFF, or a 36 bit grayscale TIFF, or an 11-13-15 bits per sample 
RGB TIFF. It's all unambigious, and all legit. It is, however, badly 
supported by most readers.


Best regards,

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@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
