tags:

views:

175

answers:

1

I'm trying to download images from URLs and pass them to PIL.

I would like to use less resources as possible, especially RAM. What would the best way of dealing with this? I've had suggestions to use cStringIO.

+2  A: 

Unfortunately file-likes from network functions such as urllib2.urlopen() don't support all the necessary methods, so you'll need to read the data into a StringIO or cStringIO in order to be able to pass them to Image.open().

Ignacio Vazquez-Abrams