Created
December 29, 2010 06:03
-
-
Save wenbert/758243 to your computer and use it in GitHub Desktop.
get url of image and save to local file
This file contains 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
#example2.py | |
import cStringIO # *much* faster than StringIO | |
import urllib | |
import Image | |
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) | |
# now use PIL | |
print img.format, img.size, img.mode | |
img.save('my_copy.gif') | |
# delete img if you need to save space and work on large images | |
del img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment