import requests from io import BytesIO from PIL import Image r = requests.get("https://cutewallpaper.org/21/anything-wallpapers/Anything-Wallpapers-Wallpaper-Cave.png") image = Image.open(BytesIO(r.content)) path = "./image."+image.format try: image.save(path, image.format) except IOError: print("Cannot save image")