We would like to know how to save image from URL(web) to jpg, png and gif format file.
import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; /* w w w. jav a 2s . c om*/ import javax.imageio.ImageIO; public class Main { public static void main(String[] args) throws Exception { BufferedImage image = null; URL url = new URL("URL_IMAGE"); image = ImageIO.read(url); ImageIO.write(image, "jpg", new File("C:\\out.jpg")); ImageIO.write(image, "gif", new File("C:\\out.gif")); ImageIO.write(image, "png", new File("C:\\out.png")); System.out.println("Done"); } }