jai-imageio / jai-imageio-jpeg2000

JPEG2000 support for Java Advanced Imaging Image I/O Tools API
Other
72 stars 56 forks source link

Image read wrongly turns out mostly black #38

Open THausherr opened 2 years ago

THausherr commented 2 years ago

x.zip

Reading this file with ImageIO.read() and writing it with ImageIO.write() wrongly brings a visually black image. IrfanView claims it has 947 unique colors. IrfanView correctly displays the source image, and claims it has 12 BitsPerPixel.

Using the example "How to read a JP2 or JPX image" at https://github.com/faceless2/jpeg2000/ creates a correct .ppm image; iin.getBitsPerComponent() returns 8. So maybe they fixed that bug some time ago.

Source of that image: https://bugzilla.mozilla.org/show_bug.cgi?id=1659412

THausherr commented 1 year ago

I had another look, I think that the problem is that the 3x4bit values aren't scaled up to 2x8bit values when the BufferedImage is created.