read 48bit RGB tile float-Tiff image directly and change 24bit RGB DIB Buffer in leptonica

  16-bit, c++, floating-point, leptonica

I tried to open a 48-bit RGB float tile tiff image in leptonica, but the internal method TiffReadRGBAOriented returned an error.
So, when I checked the value of the Buffer using the TIFFReadTile method, it was as follows.
66 3a 66 3a 66 3a 66 3a 66 3a 66 3a 66 3a 66 3a 66 3a …

The following is the tag value of the target tiff image.

(TIFFTAG_BITPERSAMPLE cnt = 3, value = 16)

(TIFFTAG_SAMPLEFORAMT value = 3 [IEEE float])

(TIFFTAG_PHOTOMETRIC value = 2 [RGB])

The RGB of the (0, 0) pixel of the target tiff was (231, 231, 231) .
I think that the [66, 3a] part of 16-bit matches with 231 of 8-bit, but even after mapping after memcpy, 231 did not come out.

How do I convert 16-bit float data to 8-bit char format?

Source: Windows Questions C++

LEAVE A COMMENT