0

I'm developing python code to save images from an api call.

My code is the following:

r = requests.get(urlGetPhoto, headers=h, stream=True)

After this call i obtain the image in in formats byte inside r.content. Printing the content with postman I see that it is composed in the following way

<img src="data:image/jpg;base64,/9j/4...A/9k=" alt="Image"/>

I tried to convert it to image in several ways, but no ine gave me a readable image. How can I perform this conversion to save the content?

  • pls try this (resource)[https://stackoverflow.com/questions/13137817/how-to-download-image-using-requests], if none of those worked, pls share the URL of the image. – simpleApp Feb 08 '23 at 15:35
  • 1
    Hi, I find the solution cutting off the excess parts of data such as Image . Then with the answers of the suggested question I solved. Thanks you – leogamer2222 Feb 09 '23 at 08:36

0 Answers0