Example code using files.
File in = new File("bmp filespec");
File out = new File("jpg filespec");
BufferedImage bufi;
try
{
bufi = ImageIO.read(in);
ImageIO.write(bufi, "jpg", out);
}
catch (IOException ex)
{
ex.printStackTrace();
}
Thanks for the code. It works well when I run it in JRE 1.6 but fails in JRE1.4 with a NullPointerException. The problem is with this line:?br>
bufi = ImageIO.read(in);
I believe JDK1.4 does not support reading a bmp file format. Is this the problem? And if so, is there a Java work-around apart from migrating to JDK 1.5 or 1.6?