Home > other >  There is something wrong with the PIL read binary image
There is something wrong with the PIL read binary image

Time:09-16

Flask to receive front-end sent back to the binary image to use PIL read (Pillow), use the BytesIO, but opened the black piece piece it became





(note the cont==img. Tobytes () to False)



Show the pictures into a black piece piece

CodePudding user response:

Online search along while didn't find where is wrong, to solve

CodePudding user response:

To test whether the file is normal, submit the key is fileData files

CodePudding user response:

You try these:

1. Keep the binary bytes out whether the beginning part of the expected data: Png have Png
Like
https://blog.mythsman.com/post/5d2d62b4a2005d74040ef7eb/
The


- "to make sure that you receive the data is normal

2. Then about image transformation or preserve relevant code can refer to my

Pillow, commonly used Python code

CodePudding user response:

problem has been solved!

Is the front back to the canvas images toDataUrl function parameter error!

Thank you all!
  • Related