Image rendering

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Image rendering

Prash-4
Hi Guys .. need some help. My task is to fetch image from a url and
then display using gtk image.

I'm fetching image like
import urlib
f=urllib.urlopen("http://someserver.x.jpg")

f.read()  gives me a raw string. Now how do i display this using gtk image??

TIA
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: Image rendering

Jody Steele
One way to do it, maybe not the "correct" way, would to be create a
temporary file that contains the contents of the file you retrieved from
the URL, and then load that into the gtk.Image.

You probably want to look into the tempfile module.

Hope this helps.

Jody Steele



On Sun, 05 Jun 2005 15:37:05 -0400, Prash <[hidden email]> wrote:

> Hi Guys .. need some help. My task is to fetch image from a url and
> then display using gtk image.
>
> I'm fetching image like
> import urlib
> f=urllib.urlopen("http://someserver.x.jpg")
>
> f.read()  gives me a raw string. Now how do i display this using gtk  
> image??
>
> TIA
> _______________________________________________
> pygtk mailing list   [hidden email]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: Image rendering

Prash-4
Sorry I didn;t mention in my post - I wanted to display that raw data
directly than having to save it to a file. Is this possible?

On 6/6/05, Jody Steele <[hidden email]> wrote:

> One way to do it, maybe not the "correct" way, would to be create a
> temporary file that contains the contents of the file you retrieved from
> the URL, and then load that into the gtk.Image.
>
> You probably want to look into the tempfile module.
>
> Hope this helps.
>
> Jody Steele
>
>
>
> On Sun, 05 Jun 2005 15:37:05 -0400, Prash <[hidden email]> wrote:
>
> > Hi Guys .. need some help. My task is to fetch image from a url and
> > then display using gtk image.
> >
> > I'm fetching image like
> > import urlib
> > f=urllib.urlopen("http://someserver.x.jpg")
> >
> > f.read()  gives me a raw string. Now how do i display this using gtk
> > image??
> >
> > TIA
> > _______________________________________________
> > pygtk mailing list   [hidden email]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> >
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Fwd: Image rendering

Chris Lambacher
Sorry, reply to all is not the default in gmail.

-Chris

---------- Forwarded message ----------
From: Chris Lambacher <[hidden email]>
Date: Jun 6, 2005 2:10 PM
Subject: Re: [pygtk] Image rendering
To: Prash <[hidden email]>


gtk.gdk.PixbufLoader looks like it will do what you want:
http://www.pygtk.org/pygtk2reference/class-gdkpixbufloader.html

import urlib
f=urllib.urlopen("http://someserver.x.jpg")
pbl = gtk.gdk.PixbufLoader()
pbl.write(f.read())
pb = pbl.get_pixbuf()
pbl.close()


Above is just an example, I did not try it out.  There seems to be a
lot of flexibility in how you actually get data in and out of the
loader.

-Chris

On 6/6/05, Prash <[hidden email]> wrote:

> Sorry I didn;t mention in my post - I wanted to display that raw data
> directly than having to save it to a file. Is this possible?
>
> On 6/6/05, Jody Steele <[hidden email]> wrote:
> > One way to do it, maybe not the "correct" way, would to be create a
> > temporary file that contains the contents of the file you retrieved from
> > the URL, and then load that into the gtk.Image.
> >
> > You probably want to look into the tempfile module.
> >
> > Hope this helps.
> >
> > Jody Steele
> >
> >
> >
> > On Sun, 05 Jun 2005 15:37:05 -0400, Prash <[hidden email]> wrote:
> >
> > > Hi Guys .. need some help. My task is to fetch image from a url and
> > > then display using gtk image.
> > >
> > > I'm fetching image like
> > > import urlib
> > > f=urllib.urlopen("http://someserver.x.jpg")
> > >
> > > f.read()  gives me a raw string. Now how do i display this using gtk
> > > image??
> > >
> > > TIA
> > > _______________________________________________
> > > pygtk mailing list   [hidden email]
> > > http://www.daa.com.au/mailman/listinfo/pygtk
> > > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> > >
> >
> >
> >
> > --
> > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> >
> _______________________________________________
> pygtk mailing list   [hidden email]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>


--
Christopher Lambacher
[hidden email]


--
Christopher Lambacher
[hidden email]
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/