2013.04.16 09:55 "[Tiff] How 16bits-RGBA image pixels are interlaced ?", by Rémy_Abergel

2013.04.16 12:55 "Re: [Tiff] How 16bits-RGBA image pixels are interlaced ?", by Rémy_Abergel

Thank you for your answer, I'm going to have a look on your reader, and eventually come back with new questions.

Regards,

Rémy A.

Le 16/04/2013 12:38, jcupitt@gmail.com a écrit:

On 16 April 2013 10:55, Rémy Abergel <remy.abergel@parisdescartes.fr> wrote:

In case of a 16 bits per channel RGBA image, could you tell me how can I deinterlace pixels?

I use TIFFReadEncodedStrip() (or TIFFReadTile() for a tiled image) to read decoded pixels to a buffer. libtiff returns pixels in the host byte order by default, so for RGB16 you can just do:

struct Pixel {
  uint16 R;
  uint16 G;
  uint16 B;
}

Pixel buffer[...size this carefully...];

TIFFReadEncodedStrip (tiff, strip_number, buffer, -1);

My reader is here:

https://github.com/jcupitt/libvips/blob/master/libvips/foreign/tiff2vips.c

You're welcome to use any parts of it.