PIL Image from Url

Had some troubles finding what seemed to be such an easy Google search. Needed the capability to load an image based on a url. Here is my solution:

[code]
import urllib2 as urllib
from PIL import Image
from cStringIO import StringIO

img_file = urllib.urlopen(self.image.url)
im = StringIO(img_file.read())
resized_image = Image.open(im)
[/code]

5 Responses to PIL Image from Url

Leave a Reply

Your email address will not be published. Required fields are marked *