I opened the image and converted it to an image with a 16-color palette using this code:
im = Image.open("SomeImage.png") im = im.convert("P") im = im.convert("P", palette = Image.ADAPTIVE, colors = 16)
I can get pixel data using:
im.getpixel((x,y))
Returns an integer corresponding to the color index in the palette. How can I get a palette as a list of colors?
source share