You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rick Harding <ma...@gmail.com> on 2021/05/28 21:27:03 UTC

Write 16bit greyscale TIFF is not correct/supported

Hi,

I am trying to use apache-commons-imaging to write 16-bit greyscale TIFF
images. However, the TIFF writer appears to be incorrect. Based on the
compression type you get either:

samplesPerPixel = 3
bitsPerSample = 8
photometricInterpretation = 2
(RGB image)

or

samplesPerPixel = 1
bitsPerSample = 1
photometricInterpretation = 0
(bitmap image)

Neither of which is correct for a 16-bit greyscale image (the BufferedImage
passed in uses TYPE_USHORT_GRAY) which should be:

samplesPerPixel = 1
bitsPerSample = 16
photometricInterpretation = 1 (or possibly zero, but minIsBlack is probably
the better default)