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:
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)


Nice,
Worked like a charm! I also discovered the difference between:
import StringIO vs. from cStringIO import StringIO
I was actually grabbing an image from S3 and was about to invoke the S3 library “get” when I saw this post. Right of course, my S3 images are public so why not just use urllib2.
Thanks for making me think outside the box.
Regards
Great, thanks for sharing this.