I need to load an image from a web in a simple Java stand alone aplication. Any Ideas?
+1
A:
I would take a look at HTTPClient.
Find the URL to the image, and you can get an inputstream feeding you the image data, plus you'll get the content-type etc. so you can correctly handle it once you've downloaded it.
Here's some sample code. You may also need to call getResponseHeaders() on the GetMethod to identify the image type.
Brian Agnew
2009-05-29 16:40:57
+1
A:
URL url = new URL("http://host/theimage.jpg");
URLConnection conn = new URLConnection(url);
InputStream in = conn.getInputStream();
is that enough to start you? Don't know what you want to do from there.
Gary Kephart
2009-05-29 16:44:41
+6
A:
You can load an image using
BufferedImage img = ImageIO.read(new URL("http://stackoverflow.com/content/img/so/logo.png"));
For methods how to display the loaded image, see the Sun "Working with images" tutorial.
rodion
2009-05-29 16:50:49