I have a bytearray as well as image height and width which holds the RGBA BMP image data. I would like to save it to a file.
I tried with PIL image library but with no lock.
stream = BytesIO(b_array)
Image.open(stream)
image = Image.open(stream)
stream.close()
image.save("test.bmp")
The error received
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001E522690D10>
Any help here?
BTW, I don't need BMP, any popular image file format works with me.