Corrupted images using ImageIO.read.
I have looked around and it seems to be a lot of confusion about the point that the corruption occurs. After trying a lot of thing I simplified it to the following code:
final BufferedImage bimg = ImageIO.read(file);
JComponent mC =new JComponent(){
publicvoid paint(Graphics c){
c.drawImage(bimg, 0, 0, null,null);
super.paint(c);
}
};
JFrame ff =new JFrame(file.getName());
ff.add(mC);
ff.setVisible(true);
ff.pack();
ff.setSize(800, 600);
ff.validate();
Which as I understand means that the corruption happens at read time.
#Image formats:gif,jpeg
#Result:
Some read ok
Some read half ok/half corrupted (top screen ok/bottom corrupted)
Some read with overlaying corruption (ie. the image layers are out of place)
#JVM
1.4.2
Java 6 (latest as of 8/6/2007)
#IDE
RAD (IBM Eclipse)
Thank you

