How do I read image data from a URL in Python?

The following works for Python 3:

from PIL import Image
import requests

im = Image.open(requests.get(url, stream=True).raw)

References:

Leave a Comment