Replace colors in colormap (python 3.7)
问题 I use a simple line to break an indexed image 256 color into palette using import numpy as np from PIL import Image im = Image.open('') palette = np.array(im.getpalette(),dtype=np.uint8).reshape((256,3)) ##################### Printed result [[ 1 3 0] [ 2 4 1] [ 28 0 4] [ 20 2 26] [ 24 5 18] [ 33 7 22] [ 36 7 12] [ 0 20 18] [ 42 15 16] [ 43 18 30] ... etc Printing 'palette' lists the colors as RGB values as listed from index 0 onward. Index 0 is often dark color or black. In some engines it is