import matplotlib.pyplot as plt
import requests
r = requests.get('https://checkimage.etest.net.cn/65DE0E55A627E56EAA0FA6F8198D2A43.jpg')
How can I use r.text
to show the image directly and what kind of encoding it is?
As the request documentation states:
from PIL import Image
from io import BytesIO
i = Image.open(BytesIO(r.content))
So in your case:
import matplotlib.pyplot as plt
import requests
from PIL import Image
from io import BytesIO
r = requests.get('https://checkimage.etest.net.cn/65DE0E55A627E56EAA0FA6F8198D2A43.jpg')
im = Image.open(BytesIO(r.content))
plt.imshow(im)
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.