-
Bug
-
Resolution: Duplicate
-
P4
-
1.4.2, 5.0, 6u10, 7, 7u10
-
generic, x86
-
generic, windows_2000, windows_xp, windows_vista
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2197054 | 6 | Andrew Brygin | P3 | Closed | Won't Fix |
FULL PRODUCT VERSION :
java version " 1.5.0_06"
java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Service Pack 2
A DESCRIPTION OF THE PROBLEM :
Java ImageIO reads certain JPG files and generates faulty images looking like a red-filter has been applied.
These JPEGS work fine using other Imaging-Applications like IRFANVIEW, Photoshop etc. and are also displayed correctly in any browser.
Even using the "old" java way, using the Toolkit Classes works fine (java.awt.Toolkit.getDefaultToolkit().createImage(...) ).
Just Java ImageIO produces these red images.
This problem seems to be a similar one as bug #4881314, but is not fixed in 1.5.0_04 as mentioned there.
This also occurs with:
J2SE 1.4.1_06 on Windows XP
J2SE 1.4.2_06 on Windows XP
J2SE 1.5.0_03 on Windows XP
and with latest release as mentioned above
J2SE 1.5.0_06 on Windows XP
The code necessary to reproduce this behaviour looks like:
File f = new File("W:/java/ImageIORedColored-1.jpg");
//File f = new File("W:/java/ImageIORedColored-2.jpg");
BufferedImage bi = ImageIO.read(f);
JFrame f = new JFrame();
JLabel l = new JLabel(new ImageIcon(bi));
f.setContentPane(l);
f.pack();
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.setVisible(true);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Examples of affected JPEGs can be found here:
http://cobra.levigo.de/java/ImageIORedColored-1.jpg and
http://cobra.levigo.de/java/ImageIORedColored-2.jpg
Start the appended JPEG_Test Demo application.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The generated image should have the correct colors.
ACTUAL -
The generated image looks if a red filter has been applied.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class JPEG_Test extends JFrame{
JPEG_Test(){
super("ImageIO JPEG Test");
File f = new File("W:/java/ImageIORedColored-1.jpg");
// File f = new File("W:/java/ImageIORedColored-2.jpg");
BufferedImage bi = null;
try {
bi = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}
JLabel l = null;
if (bi != null)
l = new JLabel(new ImageIcon(bi));
else
l = new JLabel("Problems occured.");
setContentPane(l);
pack();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
new JPEG_Test();
}
}
---------- END SOURCE ----------
java version " 1.5.0_06"
java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Service Pack 2
A DESCRIPTION OF THE PROBLEM :
Java ImageIO reads certain JPG files and generates faulty images looking like a red-filter has been applied.
These JPEGS work fine using other Imaging-Applications like IRFANVIEW, Photoshop etc. and are also displayed correctly in any browser.
Even using the "old" java way, using the Toolkit Classes works fine (java.awt.Toolkit.getDefaultToolkit().createImage(...) ).
Just Java ImageIO produces these red images.
This problem seems to be a similar one as bug #4881314, but is not fixed in 1.5.0_04 as mentioned there.
This also occurs with:
J2SE 1.4.1_06 on Windows XP
J2SE 1.4.2_06 on Windows XP
J2SE 1.5.0_03 on Windows XP
and with latest release as mentioned above
J2SE 1.5.0_06 on Windows XP
The code necessary to reproduce this behaviour looks like:
File f = new File("W:/java/ImageIORedColored-1.jpg");
//File f = new File("W:/java/ImageIORedColored-2.jpg");
BufferedImage bi = ImageIO.read(f);
JFrame f = new JFrame();
JLabel l = new JLabel(new ImageIcon(bi));
f.setContentPane(l);
f.pack();
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.setVisible(true);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Examples of affected JPEGs can be found here:
http://cobra.levigo.de/java/ImageIORedColored-1.jpg and
http://cobra.levigo.de/java/ImageIORedColored-2.jpg
Start the appended JPEG_Test Demo application.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The generated image should have the correct colors.
ACTUAL -
The generated image looks if a red filter has been applied.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class JPEG_Test extends JFrame{
JPEG_Test(){
super("ImageIO JPEG Test");
File f = new File("W:/java/ImageIORedColored-1.jpg");
// File f = new File("W:/java/ImageIORedColored-2.jpg");
BufferedImage bi = null;
try {
bi = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}
JLabel l = null;
if (bi != null)
l = new JLabel(new ImageIcon(bi));
else
l = new JLabel("Problems occured.");
setContentPane(l);
pack();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
new JPEG_Test();
}
}
---------- END SOURCE ----------
- backported by
-
JDK-2197054 ImageIO creates faulty images of certain standard JPG files
-
- Closed
-
- duplicates
-
JDK-6785440 ImageIO: Images are appearing as Pink
-
- Closed
-
-
JDK-8041501 ImageIO reader is not capable of reading JPEGs without JFIF header
-
- Resolved
-