Reputation: 55
I am trying to load an image from a specific URL using the Image.Open() method from the PIL library, however I am getting the following error:
'Response' object has no attribute 'read'
My code is as follows:
image1 = Image.open(requests.get(URL))
Upvotes: 1
Views: 1046
Reputation: 102862
This is addressed in the requests
Quickstart:
from PIL import Image
from io import BytesIO
i = Image.open(BytesIO(r.content))
where r
is a Response
object such that r = requests.get(URL)
.
Upvotes: 1