admin管理员组文章数量:1401291
I'm trying to open an image at a URL using Pillow, but it only works for some URL. In my code below, URL1 works but not URL2.
import requests
from PIL import Image
url1 = "/200"
# url2 = ".jpg"
image = Image.open(requests.get(url, stream=True, verify=False).raw)
If I run the code with URL2, it gives me an error:
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x...>
I am able to open both URLs with my browser so I'm really curious as to why. Are there any methods that will work on both?
Thanks
本文标签: pythonPILUnidentifiedImageError for some image URLbut not othersStack Overflow
版权声明:本文标题:python - PIL.UnidentifiedImageError for some image URL, but not others - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744278753a2598547.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论