JDK-6549882 : PNG reader should load RGB[A] images in display-optimal format
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-04-24
  • Updated: 2011-01-19
  • Resolved: 2007-09-11
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 6 JDK 7
6u18Fixed 7 b20Fixed
Related Reports
Relates :  
Description
PNG reader should load RGB[A] images in display-optimal format as do the JPEG and BMP readers.

Comments
EVALUATION The idea of this fix is to force png reader to create buffered image of some standard type for pngs of color type RGB or RGBAlpha and bit depth 8. I suggest to add appropriate standard image types to the list of image types constructed by the reader. Namely: * for RGB color type we add TYPE_3BYTE_BGR, TYPE_INT_RGB and TYPE_INT_BGR. * for RGBAlpha color type we add TYPE_4BYTE_ABGR and TYPE_INT_RGB. Also we need to override getRawImageType() method to keep custom image type as a raw one. Note that destination types based on InteherInterleaveRaster (TYPE_INT_RGB, TYPE_INT_BGR, TYPE_INT_ARGB) may cause performance degradation. It is because ByteInterleavedRaster provides optimized setRect() routine if argument is raster of same type. However IntegerInterleasvedRaster does not provide optimized setRect() implementation and uses generic one inherited from WritableRaster class. It seems to me that we get some improvements if we will use getPixel()/setPixel() approach instead of setRect() for raster differ form ByteInterleavedRaster.
01-08-2007

WORK AROUND Copy the loaded image into a non-TYPE_CUSTOM image thereby doubling the memory.
24-04-2007

SUGGESTED FIX Two possible fixes: 1) Support two image types for RGB and RGBA, one corresponding to the existing type and one corresponding to TYPE_3BYTE_BGR and TYPE_4BYTE_ABGR[_PRE], respectively. 2) Replace the raw image type with the non-TYPE_CUSTOM variant.
24-04-2007