When you create your image_string
, you're creating a fake file-like object backed by a string. When you call Image.open
, it reads this fake file, moving the file pointer to the end of the file. Attempting to use Image.open
on it again just gives you an EOF.
You need to either re-create your StringIO
object, or seek()
to the beginning of the stream.