code
def captureTestImage(settings, width, height):
#command defined here
subprocess.run(command[0],shell=True,executable="/usr/bin/bash")
imageData = BytesIO()
imageData.write(subprocess.check_output(command, shell=True))
imageData.seek(0)
im = Image.open(imageData) # SEEMS TO FAIL HERE
im.save(imageData, "JPG")
imageData.seek(0)
buffer = imageData.read()
imageData.close()
return im, buffer
actual error receiving:
im = Image.open(imageData)
File "/home/user/.local/lib/python3.9/site-packages/PIL/Image.py", line 3339, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fbbf04b30>
What is going wrong here?
This is creating an actual image file, but the script is returning this error- why? How can I fix? Thank you