import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; public class Exec { public static void main(String args[]) { writeImageLocal( "c:\\local.jpg", loadImageUrl("http://someip/someimg.jpg")); } public static BufferedImage loadImageUrl(String imgName) { try { URL url = new URL(imgName); return ImageIO.read(url); } catch (IOException e) { System.out.println(e.getMessage()); } return null; } public static void writeImageLocal(String newImage, BufferedImage img) { if (newImage != null && img != null) { try { File outputfile = new File(newImage); ImageIO.write(img, "jpg", outputfile); } catch (IOException e) { System.out.println(e.getMessage()); } } } }