Skip to content

Instantly share code, notes, and snippets.

@mizunashi-mana
Last active September 16, 2016 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizunashi-mana/4f5d6b660bacd806981076b218931bf7 to your computer and use it in GitHub Desktop.
Save mizunashi-mana/4f5d6b660bacd806981076b218931bf7 to your computer and use it in GitHub Desktop.
import urllib2
from io import BytesIO
from PIL import Image
url = 'http://cdn1.www.st-hatena.com/users/da/daiiz/profile.gif?1451834248'
filePointer = urllib2.urlopen(url)
data = filePointer.read()
filePointer.close()
image = Image.open(BytesIO(data))
image.show()
from PIL import Image
from io import BytesIO
import base64
data = 'R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=='
bytesdata = BytesIO(base64.b64decode(data))
im = Image.open(bytesdata)
im.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment