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