Load images from URLs using Pillow in Python 3

I got an error with StringIO and it was painful, but it seems that there is BytesIO, and I was able to use it. Specifications that handle character strings differently between Python3 and Python2 have an effect on reading files.

import io
import urllib.request
from PIL import Image
f = io.BytesIO(urllib.request.urlopen("Image URL").read())
img = Image.open(f)

Recommended Posts

Load images from URLs using Pillow in Python 3
Extract text from images in Python
Download images from URL list in Python
Create a GIF file using Pillow in Python
Load and execute command from yml in python
Bulk download images from specific URLs with python
Detect Japanese characters from images using Google's Cloud Vision API in Python
Bulk download images from specific site URLs with python
Save images using python3 requests
Base64 encoding images in Python 3
OCR from PDF in Python
Translate using googletrans in Python
Using Python mode in Processing
View images in OpenCV from Python using an external USB camera on your MacBook
Predict gender from name using Gender API and Pykakasi in Python
Number recognition in images with Python
Pixel manipulation of images in Python
GUI programming in Python using Appjar
Precautions when using pit in Python
Download images from "Irasutoya" using Scrapy
Cropping images at once [python] [Pillow]
Using Rstan from Python with PypeR
Get data from Quandl in Python
How to collect images in Python
Dynamically load json type in python
Try using LevelDB in Python (plyvel)
Generating multilingual text images using Python
Using global variables in python functions
Using Cloud Storage from Python3 (Introduction)
Post images from Python to Tumblr
Let's see using input in python
Infinite product in Python (using functools)
Load gif images with Python + OpenCV
Edit videos in Python using MoviePy
Run Ansible from Python using API
Handwriting recognition using KNN in Python
Precautions when using phantomjs from python
Access spreadsheets using OAuth 2.0 from Python
Try using Leap Motion in Python
Depth-first search using stack in Python
When using regular expressions in Python
Working with DICOM images in Python
Try using Amazon DynamoDB from Python
Extract strings from files in Python
GUI creation in python using tkinter 2
Object extraction in images by pattern matching using OpenCV with Python
Watershed method in 3D images using ImageJ
Mouse operation using Windows API in Python
Load the remote Python SDK in IntelliJ
Notes using cChardet and python3-chardet in Python 3.3.1.
Try using the Wunderlist API in Python
Get exchange rates from open exchange rates in Python
From Python to using MeCab (and CaboCha)
GUI creation in python using tkinter part 1
Generate AWS-S3 signed (time-limited) URLs in Python
Get Suica balance in Python (using libpafe)
(Bad) practice of using this in Python
Slowly hash passwords using bcrypt in Python
Try using the Kraken API in Python
Mosaic images in various shapes (Python, OpenCV)
Revived from "no internet access" in Python