JDK-6399660 : PIT: Using subsampling with compression alters the colors for some of the image types for BMP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 5.0,6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-03-16
  • Updated: 2011-01-19
  • Resolved: 2006-04-19
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.
6 b81Fixed
Related Reports
Duplicate :  
Relates :  
I am setting a sub-sampling value in the ImageWriteParam and trying to write each of the buffered image types using BMP Writer, using all the supported compression types. But in the PIT build for Mustang-b77, I am noticing the following behaviors:

1. Writing TYPE_INT_RGB using BI_BITFIELDS compression alters the image colors when subsampling is specified.

2. TYPE_INT_BGR did not work fine before because of the bug 6299168 but it works fine on the current PIT build

3. Writing TYPE_3BYTE_BGR using BI_RGB, BI_BITFIELDS compression types with subsampling set makes the image appear bluish.

4. Writing TYPE_USHORT_565_RGB with BI_BITFIELDS compression and subsampling makes the output image appear in different color.

5. Writing TYPE_USHORT_555_RGB using BI_RGB, BI_BITFIELDS compression types alters the image colors and BI_BIFIELDS image is slightly corrupted.

All the above behaviors are noticed only on the PIT build and not reproducible on Mustang-b75 or earlier. All the above issues are reproducible on Win32 as well as Solaris. All the issues are hence regressions introduced in the b77 PIT build.

I have attached a sample test with the necessary images. Run the test on the PIT build. You would see a frame with a choice. Click on the items in the choice one by one to test each of those buffered image types. You will notice that the image colors are altered for the above cases.

EVALUATION The fix for 5076878 shifts problem with writing subsampled images from case of BI_RGB compression to case BI_BITFIELDS compression. To solve this problem we should separate these two cases: - for BI_RGB compression the BGR order of raster data should be used (except the case of 16bpp images where RGB data order is defined by the BMP spec) - for BI_BITFIELDS compression order of raster data should be defined using corresponding masks. In case of default bitfields masks the RGB order of raster data is used.