티스토리 뷰

공부

[Python] url to image

seunggabi 승가비 2021. 1. 14. 06:48
728x90
pip3 install requests
pip3 install Pillow
from PIL import Image
import requests
import time

file = Image.open(requests.get(image, stream=True).raw)
filename = time.time() + '.png'
file.save(filename)

https://stackoverflow.com/questions/7391945/how-do-i-read-image-data-from-a-url-in-python

 

How do I read image data from a URL in Python?

What I'm trying to do is fairly simple when we're dealing with a local file, but the problem comes when I try to do this with a remote URL. Basically, I'm trying to create a PIL image object from ...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[PHP] str_replace("a", "b" "abc") -> "bbc"  (0) 2021.01.14
[Python] typeof -> `isinstance(s, str)`  (0) 2021.01.14
[Python] url to image  (0) 2021.01.14
Date format day `EEE` or `EEEE`  (0) 2021.01.14
[Python] for by date  (0) 2021.01.09
[Sh] for date `start ~ end`  (0) 2021.01.09
댓글
댓글쓰기 폼