PIL open() method not working with BytesIO

Think of BytesIO as a file object, after you finish writing the image, the file’s cursor is at the end of the file, so when Image.open() tries to call output.read(), it immediately gets an EOF.

You need to add a output.seek(0) before passing output to Image.open().

Leave a Comment