Converted the image so that pillow can quantize the colors to 256 max (adaptive to the colors in the image).
Then converted it back to an normal RGB image so that existing logic does not break.
This also prevents another issue where a png which was saved with a pallete could not be loaded.
In the long run the second conversion should be removed and the palette and colors of the P mode image could be used in a more direct way.
Converted the image so that pillow can quantize the colors to 256 max (adaptive to the colors in the image).
Then converted it back to an normal RGB image so that existing logic does not break. This also prevents another issue where a png which was saved with a pallete could not be loaded.
In the long run the second conversion should be removed and the palette and colors of the
P
mode image could be used in a more direct way.