AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.12.07 12:25 "[Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 11:32 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 12:38 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 11:48 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 12:57 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 12:21 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 13:02 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 15:50 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 15:52 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn
2004.12.07 17:46 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field
2004.12.07 17:04 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn
2004.12.07 20:00 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Joris
2004.12.07 20:41 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Bob Friesenhahn

2004.12.07 17:46 "Re: [Tiff] Fetching pixel data from 4bit tiff", by Dan Field

Hi. I'm new to libtiff and I'm no C guru either, so please excuse my ignorance here.

I am trying to get pixel data from a 4bit TIFF. I can use TIFFReadRGBAImage, TIFFReadR, TIFFReadG, TIFFReadB, TIFFReadA but surely these will not provide the correct data for a 4bit image?

What method should I use to work with the raster, and what sort of data should I expect from a 4bit image pixel?

You should use TIFFReadScanline() to read each scanline into memory you have allocated. There is one scanline per row. The scan-line is returned packed according to the TIFF specification, with two samples per byte. It is a small matter of masking and shifting to obtain each nibble. The only tricky case is to properly handle an image with an odd number of columns.

This appears to work with rows though. I need to sample from columns aswell as rows. Is there any way to take a vertical scanline with this function?

--
Dan Field <dof@llgc.org.uk> http://www.cymruarywe.org/
                                       http://www.walesontheweb.org/
     Developer / Sysadmin
     Llyfyrgell Genedlaethol Cymru