// An example of image reading/writing in Java // // Converts a jpg to a png file (name Hard-Coded) // // REF: http://java.sun.com/developer/JDCTechTips/2004/tt0217.html#1 // // M. Branicky, 10/09/06 import java.awt.image.*; import javax.imageio.*; import java.io.*; public class jpg2pngHC { public static void main (String args[]) throws IOException { // open and read the input image File inputFile = new File("bakeonceeatanywhere.jpg"); BufferedImage input = ImageIO.read(inputFile); // write the output image File outputFile = new File("bakeonceeatanywhere.png"); ImageIO.write(input, "png", outputFile); } }