seikichi / tiff.js

tiff.js is a port of LibTIFF by compiling the LibTIFF C code with Emscripten.
Other
387 stars 98 forks source link

how to get the raw 16 bit luminance data buffer from tiff object ? #55

Open zy4944796 opened 4 years ago

zy4944796 commented 4 years ago

Good day sir: My trouble is about tiff format that be transformed by the function tiff.toCanvas. The type of my tiff image is 16 bit grayscale, which the color format is luminance. I defined a tiff object from a buffer like this :
var tiff = new Tiff({buffer: result.target.result});
var canvasTiff = tiff.toCanvas(); When I called tiff.toCanvas() function , I found the type of the tiff data which should be 16 bit grayscale was transformed to 8bit *4 RGBA type. I don't know how to turn it back to 16 bit luminance;

Can you help me to get the raw image data buffer from the tiff object?