United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6297016 : Output BMP image is distorted when writing TYPE_3BYTE_BGR buff image with BI_BITFIELDS compression

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

Related Reports
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
I am writing a buffered image of type TYPE_3BYTE_BGR to a file using a BMP Writer. I am setting the compression type to BI_BITFIELDS in the image write param and using this param to write the image. The output image generated is completely distorted and unusable. None of the native image applications recognize this as a valid bmp image. 

The canEncodeImage() protected method in BMPWriter does not enforce any rectrictions in using this compression type with the given image, neither it throws an IOException saying this image type is not compatible with the specified compression.

This is reproducible on all platforms since Tiger-FCS.

I have attached a sample test which reproduces the bug. The 3rd image loaded onto a frame would be corrupted.
###@###.### 2005-07-14 17:35:09 GMT

                                    

Comments
EVALUATION

This problem was caused by the fact that we wrote bitfileds masks to
the bmp but do not change image data layout according to BMP format
requirements.
To fix this problem we should forec of using the writePixels() method
in order to copy image data correctly.
                                     
2005-09-26



Hardware and Software, Engineered to Work Together