1
import urllib.request
import Image


urllib.request.urlretrieve("https://www.spriters-resource.com/download/50365/", "mario_image.PNG")
img = Image.open("mario_image.PNG")  

I'm wondering how can I retrieve an image from a url and immediately convert it to a PIL Image without having to load the image from the file

1 Answers1

3
import requests
from PIL import Image

r = requests.get(URL, stream=True)
img = Image.open(r.raw)
Iván Pérez Gómez
  • 568
  • 2
  • 5
  • 13