I'm saving, converting to grayscale, and opening an image in Python with PIL like this
Image.open(imgname).convert('L').save(imgname)
And I get a matrix with one number per pixel. My image is has 3 colors. 255 for white, 0 for black and 128 for gray.
Is there anyway that when I convert my image to grayscale I can have 0 for white, 1 for gray and 2 for black when I read this image?