I\'ve been handed a list of files from the backend of an application that are supposed to be jpeg files. However for the life of me I haven\'t been able to convert them into
The same thing but a bit simpler
from PIL import Image
import io
Image.open(io.BytesIO(image))
Note:
If image is on the web; you need to download it first.
import requests
image = requests.get(image_url).content #download image from web
And then pass it to io module.
io.BytesIO(image)
If image is in your hd; you can open directly with PIL.
Image.open('image_file.jpg') #image in your HD