2012.01.04 15:08 "Re: [Tiff] reading rgb values from 16 bits tif images", by Olivier Paquet
On Wed, Jan 4, 2012 at 9:55 AM, Martin Alegre <firstname.lastname@example.org> wrote: > More precisely, how to post-process the buffer (buff) after calling the > function TIFFReadScanline(tif, buf, row)?
> Do you mind in illustratiing how to use the TIFFReadScanline for such sort > of images?
The buffer is raw image data. If your data is 16-bit RGB then it *might* look something like this:
for(c = 0; c < imageWidth; c++)
uint16 red = static_cast<uint16*>(buf)[c*nsamples+0];
uint16 green = static_cast<uint16*>(buf)[c*nsamples+1];
uint16 blue = static_cast<uint16*>(buf)[c*nsamples+2];
But this makes a lot of assumptions about how the TIFF is written and will only work on a subset of images. Unless you know the files to always have the same structure, you should definitely follow Bob's advice and use a higher level library.