Details
-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
6u10
-
x86
-
windows_vista
Description
FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsft Windows Vista Business 64 bits (Microsoft Windows [Version 6.0.6000])
A DESCRIPTION OF THE PROBLEM :
Image is appearing as pink. For more details of how to reproduce see the test case. The image shows fine if you open it in any image viewer but not within Java. If you save the same image as JPEG in MS Paint then the image displays correctly without pinkish overlay.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case.
Steps:
1) Compile
2) Run it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java shouldn't be putting no pinkish overlay when the image is shown in the frame.
ACTUAL -
At the moment it puts a pinkish overlay on top of the image.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class ImagePanel extends JPanel {
private static final long serialVersionUID = 1L;
private int width = 200;
private int height = 200;
public ImagePanel() {
try {
URL url = new URL("http://www.liambennett.com/newsite/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=6096&g2_serialNumber=2");
// This is the same image as the one specified above in the url, but has been saved as JPEG in Paint
//"http://www.liambennett.com/newsite/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=6101&g2_serialNumber=2");
BufferedImage image = ImageIO.read(url);
width = image.getWidth();
height = image.getHeight();
JLabel label = new JLabel(new ImageIcon(image));
this.add(label);
}
catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame("Image Panel");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImagePanel ip = new ImagePanel();
f.setPreferredSize(new Dimension(ip.width, ip.height));
f.getContentPane().add(ip);
f.setVisible(true);
f.pack();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsft Windows Vista Business 64 bits (Microsoft Windows [Version 6.0.6000])
A DESCRIPTION OF THE PROBLEM :
Image is appearing as pink. For more details of how to reproduce see the test case. The image shows fine if you open it in any image viewer but not within Java. If you save the same image as JPEG in MS Paint then the image displays correctly without pinkish overlay.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case.
Steps:
1) Compile
2) Run it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java shouldn't be putting no pinkish overlay when the image is shown in the frame.
ACTUAL -
At the moment it puts a pinkish overlay on top of the image.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class ImagePanel extends JPanel {
private static final long serialVersionUID = 1L;
private int width = 200;
private int height = 200;
public ImagePanel() {
try {
URL url = new URL("http://www.liambennett.com/newsite/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=6096&g2_serialNumber=2");
// This is the same image as the one specified above in the url, but has been saved as JPEG in Paint
//"http://www.liambennett.com/newsite/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=6101&g2_serialNumber=2");
BufferedImage image = ImageIO.read(url);
width = image.getWidth();
height = image.getHeight();
JLabel label = new JLabel(new ImageIcon(image));
this.add(label);
}
catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame("Image Panel");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImagePanel ip = new ImagePanel();
f.setPreferredSize(new Dimension(ip.width, ip.height));
f.getContentPane().add(ip);
f.setVisible(true);
f.pack();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround
Attachments
Issue Links
- duplicates
-
JDK-6444933 ImageIO creates faulty images of certain standard JPG files
-
- Closed
-