United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6332480 : BMP Reader fails to read the TYPE_BYTE_GRAY image encoded by BMP Writer with BI_RLE8 compression

Details
Type:
Bug
Submit Date:
2005-10-04
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2005-12-05
Component:
client-libs
OS:
generic
Sub-Component:
javax.imageio
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports

Sub Tasks

Description
I am encoding a TYPE_BYTE_GRAY image using BMP Writer with an ImageWriteParam set with the compression type - BI_RLE8. When I read back the output image using corresponding BMP Reader, the image is not completely read and only 3/4th of the image gets loaded. Rest of the image looks black. 

This is reproducible on all platforms since Tiger-FCS. (On tiger/mustang builds other than b56 PIT build, you would see an extra NPE with BI_BITFIELDS that is due to the bug - 6294960). But actually the image is created properly and all the native image viewers are able to load the image properly.

I have attached a sample test and an image. 
Run the attached test as follows:
'java BMPWriterByteGrayTest bmp'.
You would see many images being loaded on to a frame, typically one for each compression type. If the third image is not loaded completely, the bug is reproduced.

                                    

Comments
EVALUATION

The reason of problem is that RLE decoding procedures (both RLE4 and RLE8)
mistakenly use the width of destination region instead of the height to 
calculate the range of image lines for copying.
The fix is to use the height of destination region for this.
                                     
2005-10-10



Hardware and Software, Engineered to Work Together