I have a question about what to do when I read an index mode image in Python's image processing library PIL.
Read the png (index mode) image and change the pixel value as shown in the code below. Attempted to save in index mode again.
However, the output image was not colored and was black and white.
The color information is missing, but I don't know what's wrong.
Does anyone know?
I look forward to hearing from you.
Thank you for your cooperation.
Quote the answers to the similar question from an external site.
You will need to specify a palette to save in index color.
If you want to divert the palette of the original image, before saving it,
I think it would be good to add .
© 2022 OneMinuteCode. All rights reserved.