JDK-6296893 : BMP Writer handles TopDown property incorrectly for some of the compression types
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: e6u10,5.0,6u21,6u30,6u31,6u32
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS:
    generic,linux,solaris_11,windows_vista,windows_7 generic,linux,solaris_11,windows_vista,windows_7
  • CPU: generic,x86,arm
  • Submitted: 2005-07-14
  • Updated: 2015-05-27
  • Resolved: 2009-06-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b63Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
I am setting the TopDown property to true in BMPWriteParam by calling setTopDown(true). I am getting all the supported compression types and looping through them one by one and setting it to the write param. I am writing the image using each of these compression types, with topdown true using BMPImageWriter. 

I noticed that the image is actually inverted for some of the compression types such BI_RGB and BI_BITFIELDS whereas it is normal for other compression types such as BI_JPG and BI_PNG. The spec does not say anything about the dependency of TopDown on compression. I feel the behavior of TopDown must be same regardless of what compression types are used. 

This is reproducible on all platforms right from Tiger-FCS.

I have attached a sample test that would demonstrate this bug.
###@###.### 2005-07-14 14:20:11 GMT

Comments
RULE 2D_ImageIOTiger/WriterCompressionTypeTest ExitCode 255
07-05-2015

SUGGESTED FIX http://sa.sfbay.sun.com/projects/java2d_data/7/6296893
11-06-2009

EVALUATION The reason of problem is that bmp image writer does not take the isTopDown flag into account during info header writing. The height of image must be negative if isTopDown flag is true, but bmp writer always write positive image height. However, according to MSDN description, the top-down image layout is allowed only if compression type is BI_RGB or BI_BITFIELDS. Images with any other compression type must be wrote in the bottom-up layout.
02-10-2005