In Python3 the StringIO and cStringIO modules are gone.
In Python3 you should use:
from PIL import Image
import requests
from io import BytesIO
response = requests.get(url)
img = Image.open(BytesIO(response.content))
More Related Contents:
- Pillow installed, but getting “no module named pillow”
- What is the difference between images in ‘P’ and ‘L’ mode in PIL?
- ImportError: No module named PIL
- How to reduce a jpeg size to a ‘desired size’?
- How to install PIL with pip on Mac OS?
- How to write PNG image to string with the PIL?
- Convert RGBA PNG to RGB with PIL
- Trim whitespace using PIL
- How do I generate circular thumbnails with PIL?
- PIL thumbnail is rotating my image?
- How to crop an image using PIL?
- How to reduce the image file size using PIL
- ImportError: cannot import name _imaging
- Why can’t Python import Image from PIL?
- How can I save an image with PIL?
- PIL – draw multiline text on image
- PIL open() method not working with BytesIO
- How to send image generated by PIL to browser?
- How to convert PIL Image.image object to base64 string? [duplicate]
- How do I read image data from a URL?
- Load just part of an image in python
- PIL: DLL load failed: specified procedure could not be found
- create an image with border of certain width in python
- Using PIL to turn a RGB image into a pure black and white image
- how to save a pylab figure into in-memory file which can be read into PIL image?
- python tkinter how to bind key to a button
- Getting PIL/Pillow 4.2.1 to upload properly to AWS Lambda Py3.6
- Colorize image while preserving transparency with PIL?
- Checking for corrupted files in directory with hundreds of thousands of images gradually slows down
- Change specific RGB color pixels to another color, in image file