Loading image from URL with PIL

rgb122 at my-deja.com rgb122 at my-deja.com
Mon Apr 3 16:16:45 EDT 2000


Is it possible to load an image (GIF or JPEG)
straight from a URL without saving it to a file
first. I tried this:

u = urllib.urlopen
("http://localhost/cache/test.jpg")
data = u.read()
s = array.array("b", data).tostring()

But then how can I get the dimensions of the
image to pass to the fromstring function?

i = Image.fromstring("RGB", (???, ???), s)

Also, how can I convert a GIF to a JPEG using PIL?

Thanks,
Rob


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list