-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
5.0
-
generic
-
generic
I am encoding a TYPE_BYTE_GRAY buffered image using BMP ImageWriter and writing this image to a file. I am setting the compression mode to MODE_EXPLICIT and setting the compression type to BI_BITFIELDS compression type. BMP writer claims that it supports the given buffered image and the given compression type. canEncodeImage() method of BMPWriter does not enforce any restriction for this combination. The writing process was successful But there was a NPE when I tried to read the image back from the file using BMP ImageReader.
Here is the exception:
Exception in thread "main" java.lang.NullPointerException
at com.sun.imageio.plugins.bmp.BMPImageReader.readHeader(BMPImageReader.java:510)
at com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:657)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at javax.imageio.ImageIO.read(ImageIO.java:1286)
at BMPWriterByteGrayTest.<init>(BMPWriterByteGrayTest.java:135)
at BMPWriterByteGrayTest.main(BMPWriterByteGrayTest.java:208)
This is reproducible on all platforms, since Tiger-FCS.
I have attached a sample test and the image. Execute the sample test as follows:
'java BMPWriterByteGrayTest bmp'. You would see the above exception on the console.
###@###.### 2005-07-08 12:29:57 GMT
The same exception is reproducible when writing TYPE_BYTE_INDEXED image also, with the same compression type.
###@###.### 2005-07-08 12:38:09 GMT
Here is the exception:
Exception in thread "main" java.lang.NullPointerException
at com.sun.imageio.plugins.bmp.BMPImageReader.readHeader(BMPImageReader.java:510)
at com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:657)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at javax.imageio.ImageIO.read(ImageIO.java:1286)
at BMPWriterByteGrayTest.<init>(BMPWriterByteGrayTest.java:135)
at BMPWriterByteGrayTest.main(BMPWriterByteGrayTest.java:208)
This is reproducible on all platforms, since Tiger-FCS.
I have attached a sample test and the image. Execute the sample test as follows:
'java BMPWriterByteGrayTest bmp'. You would see the above exception on the console.
###@###.### 2005-07-08 12:29:57 GMT
The same exception is reproducible when writing TYPE_BYTE_INDEXED image also, with the same compression type.
###@###.### 2005-07-08 12:38:09 GMT
- duplicates
-
JDK-6297016 Output BMP image is distorted when writing TYPE_3BYTE_BGR buff image with BI_BITFIELDS compression
- Closed
- relates to
-
JDK-6294965 BMP Writer throws exception when writing TYPE_BYTE_BINARY image with BI_BITFIELDS compression
- Closed