Question

I have a buffer with 14-bit image (640 x 512). I need save this image as 16-bit TIFF.

So, each pixel takes 2 bytes, and I can trasform into grayscale (8 bit) like this:

(buffer[index] | buffer[index + 1] << 8) & 0x3FFF

(index is number of pixel for example).

As I understand, 8-bit image I can easily save as BMP using bitmap:

bmp.Save("c:\\button.gif", System.Drawing.Imaging.ImageFormat.Bmp);

But i don`t know, how can I transform it into 16-bit TIFF. Should I transform 8-bit into 16, or 14 into 16? And how?

Somebody told me I have to form some TIFF Header and add image data to this header. Is it true? Is there any example of this? Or some library to automate this process.

Était-ce utile?

La solution

You can use LibTiff .NET to save image in TIFF format:

LibTiff .NET

To convert 14 to 16 bit multiply every pixel (2 bytes) by 4.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top