java save jpg as png

I have an image on disk which is a jpg file . I want to convert and save it as png and delete original jpg. Whats best way to do this in java?

String justNameJpg = "something.jpg";
String justNamePng = ImageEditor.GetImageNameNoExtension(justName) + "." + "png";
java.awt.image.BufferedImage bufferedImage = ImageIO.read(new File(folder, justNameJpg));
ImageIO.write(bufferedImage, "png", new File(folder, justNamePng));

Answers


If you want to use ImageIO this should work:

ImageIO.write(image, "png", new File("new output file name")); 

Need Your Help

Sending a new request to another servlet in the same web container without using an extra thread

java servlets websphere

Is there any known way to send a new SOAP request from one servlet to another within a single WebContainer without consuming an additional web container thread?

QTP Installer code for windows application

vbscript qtp windows-applications

I am working on QTP automation systems. I need to write custom code in order to pick an Installer for my application and run the same. Can any one help me to guide with code snippet that I should w...