1

What I am trying to do is quite simple when dealing with a local file, but the problem comes when I try to do it with a remote URL.

Basically, I am trying to create a PIL image object from a file extracted from a URL. Of course, I could always fetch the URL and store it in a temporary file, then open it in an image object, but that seems very inefficient.

Here is what I have:

from PIL import Image
import requests
from io import BytesIO

response = requests.get(url)
img = Image.open(BytesIO(response.content)) 

So the Code is not returning the image if anyone knows.

stovfl
  • 14,998
  • 7
  • 24
  • 51

0 Answers0