2
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?

1 Answer 1

7

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.