Monday, May 14, 2007

read image from url, write to your disk using java

URL url = new URL("http://host/urlseg1/urlseg2");//image url
BufferedImage bi =;
ImageIO.write(bi,"jpg",new File("your file path - c:\\folder1\folder2\file.jpg"));


Senthil Kumar said...

Thanks Dude
Its useful for me

bbr said...

What if you had a " Icon " (e.g. java.icon) and wanted to save this to the disk as a jpg or png?

ARUL JOSE said...

@bbr: This is a way to copy the image, not an image conversion solution.

Abhishek Jain said...

Great ...
Thanks a lot sir
but it compresses the picture a little bit,
do we have any other way in which the size aof picture remain same...

Abhishek Jain