1

The object list_of_contents[0] is based64. I am trying to convert it to it's original image.

image_64_decode = base64.b64decode(list_of_contents[0]) 
image_result = open('test.jpg', 'wb') 
image_result.write(image_64_decode)
img = Image.open(r'C:\Users\st-am\CANCER_APP\test.jpg')

However, I get the following error:

PIL.UnidentifiedImageError: cannot identify image file 'C:\\Users\\st-am\\CANCER_APP\\test.jpg'

Anybody has an idea why PIL cannot identify the image?

Here is the image

Chris
  • 15,819
  • 3
  • 24
  • 37
François
  • 21
  • 2

0 Answers0