0

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.

Harald K
  • 26,314
  • 7
  • 65
  • 111
Alexey
  • 35
  • 1
  • 10
  • 2
    You can use LibTiff .NET to save image in TIFF format: http://bitmiracle.com/libtiff/ To convert 14 to 16 bit multiply every pixel (2 bytes) by 4. – Alex F Apr 29 '14 at 06:55
  • @AlexFarber , thanks! why you post a comment, not an answer? – Alexey Apr 29 '14 at 16:24

1 Answers1

0

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.

Alex F
  • 42,307
  • 41
  • 144
  • 212