On 10 December 2010 15:45, Brandon Thomas <csumajo...@att.net> wrote:
> Hey everyone,
>
> I'm new here and am starting to really work with java and gtk.
>
> Anyways I'm trying to get my application to quasi do the following
>
> retrieve an image from the web
> pack it into the container
>
> I'm having a hell of a hard time though.  The one thing I haven't done is
> for the filename, just used the URL of the image.  Will that work?
>
> Any reference or resources to this would be greatly appreciated!
>

Hi Brandon

Assuming you're using PixBuf, this works:

import java.net.URL;
import javax.imageio.ImageIO;
import org.gnome.gdk.Pixbuf;

URL u = new URL(myUrl);
BufferedImage i = ImageIO.read(u);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(i, "PNG", bos);
Pixbuf pb = new Pixbuf(bos.toByteArray());

I use it as a simple way to pull images from Web Mapping Services into PDF maps.

Best

Will Temperley

------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
java-gnome-developer mailing list
java-gnome-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer

Reply via email to