
Of course you have to compute the map, but if you already have a reference colormap as a list of triplets this is just: map= So for instance to swap first and last: pdb.plug_in_colormap_remap(image, None, 6, ) The map list is just a list of indices (the value at position X is the index in the result colormap of the color at position X in the current map). In practice, you can get the colors in the map that way: _, colormap = pdb.gimp_image_get_colormap(image)Ĭolors=) for i in range(0,len(colormap),3)] So you would just have to compute the map that transform an image palette into your required palette. The positions of colors in the colormap without visually This procedure takes an indexed image and lets you alter In Gimp: pdb.plug_in_colormap_remap(image, drawable, num_colors, map) Setting Index 0 color to Magenta and Index# to black that is usually Index 0 is not an option, it changes the value of the colors, and thus image colors! Has to be arrange indexes But that's not a batch process, thus looking for a script.īut can Python do it with GIMP using the Rearrange color (find Index# containing 255,0,255 that will be different Index # for each opened image) and then move Index# to first image for each opened image, then save/export all png's. GIMP has Map - Rearrange Color map, a window allows you to drag your Magenta to be first (Index 0) and then you have it first, no actual color value swap, just order in the color map. I need to arrange colors order in palette, or particularly move Magenta color to be first color of already indexed image. as then colors on the image also swap (black becomes magenta and magenta becomes black, it's a mess). Previously I wanted to swap color values in palette of indexed color map but that seems to be not what im looking to do.
