JDK-6294926 : BMP Reader fails to read USHORT_555_RGB images encoded by BMP Writer with BI_JPEG compression
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-07-08
  • Updated: 2011-01-19
  • Resolved: 2006-04-03
Related Reports
Duplicate :  
Description
I am using USHORT_555_RGB Image which I am writing to a file using BMP Writer with all the supported compression types. When I set the compression type to BI_JPEG, I am getting an exception when reading back the image using BMP reader.

Here is the exception:
java.io.EOFException
at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:330)
at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:350)
at com.sun.imageio.plugins.bmp.BMPImageReader.read16Bit(BMPImageReader.java:1234)
at com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:804)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at javax.imageio.ImageIO.read(ImageIO.java:1286)
at BMPWriterUshort555RGBTest.<init>(BMPWriterUshort555RGBTest.java:135)
at BMPWriterUshort555RGBTest.main(BMPWriterUshort555RGBTest.java:208)

This is reproducible on all platforms since Tiger-FCS. 

If this compression type is not supported for the specified image, the protected method canEncodeImage() in BMPWriter must be enhanced to add these conditions also. 

I have attached the sample test and the same image. Run the test as follows:
'java BMPWriterUshort555RGBTest bmp'. You will see the above exception on the console.
###@###.### 2005-07-08 11:33:32 GMT
###@###.### 2005-07-08 13:31:03 GMT

Comments
EVALUATION This problem is similar to 6294920. The BMP image reader doe not expect BI_JPEG or BI_PNG compression in case of 16 bpp images, however this compression seems to be legal. This problem have been fixed by fix for CR 6294920.
14-09-2005