AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.01.14 12:01 "COLORMAP and byte padding", by Stephan Assmus
2004.01.14 15:07 "Re: COLORMAP and byte padding", by Frank Warmerdam
2004.01.14 16:18 "Re: COLORMAP and byte padding", by Gerben Vos
2004.01.14 16:43 "Re: COLORMAP and byte padding", by Joris Van Damme
2004.01.14 17:13 "Re: COLORMAP and byte padding", by Gerben Vos
2004.01.14 17:17 "Re: COLORMAP and byte padding", by Joris Van Damme
2004.01.14 17:26 "Re: COLORMAP and byte padding", by Andy Cave
2004.01.14 17:36 "Re: COLORMAP and byte padding", by Joris Van Damme
2004.01.14 17:24 "Re: COLORMAP and byte padding", by Phillip Crews
2004.01.14 18:18 "Re: COLORMAP and byte padding", by Marti Maria
2004.01.14 19:02 "Re: COLORMAP and byte padding", by Andy Cave
2004.01.14 19:36 "Re: COLORMAP and byte padding", by Marti Maria
2004.01.14 19:48 "Re: COLORMAP and byte padding", by Andy Cave
2004.01.15 17:24 "Re: COLORMAP and byte padding", by Marti Maria
2004.01.15 17:37 "Re: COLORMAP and byte padding", by Andy Cave
2004.01.15 00:05 "Re: COLORMAP and byte padding", by Chris Cox

2004.01.14 15:07 "Re: COLORMAP and byte padding", by Frank Warmerdam

Stephan Assmus wrote:
> Hello,
> 
> I'm adding write support to the libtiff based OpenBeOS TIFF Translator. 
> I want to support palette images. The format of the colormap that
> 
> TIFFSetField(tif, TIFFTAG_COLORMAP, ???);
> 
> expects is unclear to me. In the documentation, it just says
> 
> Tag Name           Count  Type      Notes
> 
> TIFFTAG_COLORMAP   3      uint16*   1<<BitsPerSample arrays
> 
> Ok, so there are 256 entries in the palette if I have 8 bits per 
> sample. So much I follow, but what's with the uint16* ?!? And why Count 
> == 3? The BeOS colormap bitmaps all use the same system wide palette, 
> which consists of 256 entries each representing an rgb color with 3 (4 
> actually) 8 bit values for r, g, b (and alpha). Am I supposed to fit a 
> 24 bit RGB value into 16 bits and have 256 uint16s? Or do I have 3 * 
> 256 uint16s with 16 bits for each r, g and b?

Stephan,

There is no support for alpha values in the TIFF colormaps, so you just
need to deal with the red, green and blue components.  The individual
components are uint16's to give additional precision in color specification.
I have typically computed the 16bit value by multiplying the 8bit value
by 256, but that isn't really the most precise approach as 255 would not
quite become the maximum 16bit value (65535).

So, you will have 3 uint16s for each rgb tuple with values ranging
between 0 and 65535.

> I have also a couple more questions about strip size and byte padding. 
> There seem to be two alternating fields that determine strip size:
> 
> TIFFTAG_ROWSPERSTRIP       rows per strip of data
> TIFFTAG_STRIPBYTECOUNTS    bytes counts for strips
> 
> Can both be used at the same time to tell libtiff that
> 
> strip byte counts != rows per strip * samples per pixel * width ?
> 
> (So that there are some padding bytes at the end of each row...)

The stripbytecounts are normally written internally by the library and
shouldn't be touched by application code.  You should set rowsperstrip
to control the number of scanlines per strip.

Good luck,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent