Skip to content

Instantly share code, notes, and snippets.

@geekgogo
Last active March 5, 2020 02:23
Show Gist options
  • Save geekgogo/21e30a95c5a5f80b86151fc0b076a83a to your computer and use it in GitHub Desktop.
Save geekgogo/21e30a95c5a5f80b86151fc0b076a83a to your computer and use it in GitHub Desktop.
利用PIL保存url图片
from PIL import Image
import requests
from io import BytesIO
def download(url, name):
ret = requests.get(url)
image = Image.open(BytesIO(ret.content))
image.save(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment