The error is raised by PIL/Pillow, which cannot create an image given the provided array. You can check supported formats here 1 and make sure to transform the image into a listed format. Additionally, you could check, if e.g. matplotlib would allow to display the currently provided array.