HOME/Articles/

pil example test external (snippet)

Article Outline

Python pil example 'test external'

Modules used in program:

  • import urllib2

python test external

Python pil example: test external

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