batch replace/swap colors in PNG images - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: batch replace/swap colors in PNG images (/Thread-batch-replace-swap-colors-in-PNG-images) |
batch replace/swap colors in PNG images - dcraw999 - 05-12-2019 I have a few dozen PNG images in a folder. Each image has the same color palette (only 10 colors total). I am looking for a batch file to make 3 color changes to each image - here is the sequence of the changes: 1) replace ffffff with 00ff00 2) replace 000055 with ffffff 3) replace ffff00 with 000000 The changes have to be done in this order. I'm using GIMP 2.10.2 on Windows 10 64-bit. I installed BIMP, but I don't see a way to implement the color changes. I could run 3 batches too, one for each color change, or build a windows batch file to make all the changes, I'm just unsure of the GIMP code to accomplish the task. Thanks for any help/direction. RE: batch replace/swap colors in PNG images - Ofnuts - 05-12-2019 Why script? If the images aren't too big, you can
1) is either File>Open as layers followed by ofn-layer-tiles (Layer>Tiles>Join tiles), or just ofn-tiles (File>Open tiles) 2) is either ofn-layer-tiles (Layer>Tiles>Split tiles ...) followed by ofn-export-layers (File>Export all layers), or ofn-tiles (File>Export tiles) Second point, unless this is pixel art, smooth lines are rendered with pixels where the color is a mix of the colors on either side, so you may have more than 10 colors and you have to wonder what happens for these intermediate colors.
RE: batch replace/swap colors in PNG images - dcraw999 - 05-13-2019 Ofnuts, thank you for the direction. I will try the color indexing method (edit the colors in the palette). |