JDK-4836466 : Some Images written using JPEG Image Writer are not recognized by native applns
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.2,5.0,6
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic,solaris_8,windows_xp
  • CPU: generic,x86,sparc
  • Submitted: 2003-03-24
  • Updated: 2006-09-18
  • Resolved: 2003-03-24
Related Reports
Duplicate :  
Duplicate :  
Description
The buffered image types given below are not recognized properly by the native applications when written as jpg images using ImageIO - JPG Writer.
TYPE_INT_ARGB
TYPE_INT_ARGB_PRE
TYPE_4BYTE_ABGR
TYPE_4BYTE_ABGR_PRE
When i read back the jpg images through ImageIO- JPEGReader or using getImage() API they are read & shown properly. But when I try open these images using some of the native applications the native applications either throw an error or the image gets blurred.
Image Viewer on Solaris and Netscape and IE browsers on Windows throws an error when these images are opened and Images are totally blurred when viewed through Netscape on Solaris. This problem does not occur for other buffered image types and for PNG images. Typically, the jpg images written using ImageIO should be viewable through any native application that supports JPG images.

How to reproduce:
I have attached a sample code and a sample jpg image. Save them in the same folder. Run this sample code and you will see 4 images being created in the respective folder. Try opening these images using any native application and you would notice the error.

I tested using JDK1.4.2 - b18.

Comments
EVALUATION This is not an Image I/O bug, but rather a deficiency in the other applications the submitter mentions. The IIO JPEGImageWriter is able to write images with a color model that contains an alpha channel (referred to in the IJG native source code as the "NIFTY" color spaces, such as RGBA, YCbCrA, etc.), but many applications are not aware of these color spaces. So even though these images written by the IIO JPEG writer are compliant with the JPEG specification (which is blind to the various color space possiblities), some applications may not recognize color spaces that contain an alpha channel and may throw an error or render a corrupted image, as the submitter describes. Developers wishing to maintain compatibility with these other alpha-unaware applications should write images that do not contain an alpha channel (such as TYPE_INT_RGB). Developers who want the capability of writing/reading an image containing an alpha channel in the JPEG format can do so using the Image I/O API, but need to be aware that many native applications out there are not quite compliant with the YCbCrA and RGBA formats. For more information, see the Image I/O JPEG Metadata Format Specification and Usage Notes: http://java.sun.com/j2se/1.4.1/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html Closing as "not a bug". ###@###.### 2003-03-24
24-03-2003