JDK-4766734 : Incompatibility between JDK 1.4 and Windows XP Fax and Picture Viewer
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2002-10-22
  • Updated: 2002-10-22
  • Resolved: 2002-10-22
Related Reports
Duplicate :  
Description
Customer says:

I have noticed an incompatibility between JPG files that are output from Windows XP Fax and Picture Viewer and read in by JDK 1.4 (or 1.4.1). In particular, when an image is transfered from a digital camera to a Windows XP machine, then rotated and saved in the Windows XP Fax and Picture Viewer, the resulting image file appears with corrupted colors when read and saved by the ImageIO class in JDK 1.4.

Here is my code:

import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

BufferedImage buffImg = ImageIO.read (new File ("in.jpg"));
ImageIO.write (buffImg, "jpg", new File ("out.jpg"));

I have also output the file with graphics format PNG and seen similar apparent corruption of colors.

This is an image that was loaded onto Windows XP from a digital camera then rotated 90 degrees and saved with the Windows XP Fax and Picture Viewer:
http://www.adigitalsolution.net/pics/verticalOrig.jpg

Here is the same image read and written by JDK 1.4 ImageIO.read() and ImageIO.write():

http://www.adigitalsolution.net/pics/verticalJavaOut.jpg

Note that the colors appear corrupted in the above image.

This is an image copied directly from a Sony Cybershot DSC - P71 digital camera:
http://www.adigitalsolution.net/pics/horizontalOrig.jpg

Here is the same image read and written by JDK 1.4 ImageIO.read() and ImageIO.write():

http://www.adigitalsolution.net/pics/horizontalJavaOut.jpg

It appears fine (brilliant tropical colors).

Note that both images contain the "EXIF" header, which is the JPEG-like format used by many digital cameras. Some may say that the JDK 1.4 spec does not support EXIF, but the image not touched by Windows XP was read successfully. And other image editing programs read in both successfully, such as PaintshopPro and the Mozilla 1.0 web browser. But there is a specific incompatibility with JDK 1.4.

I have reproduced this problem on Windows NT 4 and Red Hat Linux 7.3 using an image file that was saved on Windows XP.

Here is a warning from Nikon about the behavior of Windows XP Fax and Picture Viewer:

http://www.dpreview.com/news/0112/01121402nikonxpwarnings.asp

Comments
WORK AROUND As mentioned in 4712797 it may be possible to work around this by using com.sun.image.codec.jpeg classes that ship with Sun's JDK, or the Toolkit decoder. ###@###.### 2002-10-22 ============================
22-10-2002

EVALUATION This is a duplicate of 4712797: ImageIO fails to decode YCbCr JPEGs that do not have a JFIF marker It is fixed in JDK 1.4.2 I verified that the submitter's file http://www.adigitalsolution.net/pics/verticalOrig.jpg displays correctly with 1.4.2 ###@###.### 2002-10-22 ============================
22-10-2002