I have a binary image, dimensions 64x63 where every pixel is a 1 or 0.
import struct
from PIL import Image
import numpy
...
i1 = Image.frombytes('1', (64, 63), r[3], 'raw')
How can I invert this image?
Edit
I attempted the suggested solution:
from PIL import Image
import PIL.ImageOps
i1 = PIL.ImageOps.invert(i1)
However, this resulted in the error:
raise IOError("not supported for this image mode")
IOError: not supported for this image mode
And this, I believe, is due to the fact that the image is neither RGB nor L(greyscale). Instead, it is a binary image file where each pixel is only either 0 or 1.