Created
December 29, 2010 06:24
-
-
Save wenbert/758257 to your computer and use it in GitHub Desktop.
Python save image from URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cStringIO # *much* faster than StringIO | |
import urllib | |
import Image | |
try: | |
file = urllib.urlopen('http://freegee.sourceforge.net/FG_EN/src/teasers_en/t_gee-power_en.gif') | |
im = cStringIO.StringIO(file.read()) # constructs a StringIO holding the image | |
img = Image.open(im) | |
img.save('/home/wenbert/uploaderx_files/test.gif') | |
except IOError, e: | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment