TIFF and LibTiff Mail List Archive

1997.01.15 19:57 "Format for different bits_per_sample", by Ken Land


I've been using libtiff for cross platform B&W images since ~1991.

Now (finally) I'm adding support in my apps for all image formats.

I'm a bit confused on how pixel samples are encoded into the user buffer by TIFFReadScanline() for different bits_per_sample values. I know that 1 bps packs 8 pixels into each byte. I assume that 2 bps packs 4 into each byte, but what about 3 bps? Does it pack 3.66 pixels into each byte? or does it waste the extra two bits?

The docs aren't real clear but seem to indicate that all bits in the buffer are used which isn't a big deal but makes building the cross platform masks a bit more interesting.

Oh yeah, while I'm at it - are there any funnies (exceptions) for 4,5,6,or 7 bps? (pallette?, RGB?, Grey?)

What about 12 or 16 bps images? Others I should know about?


Ken Land