Batch replace colors - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: Batch replace colors (/Thread-Batch-replace-colors) |
Batch replace colors - EagleEye559 - 08-07-2020 Hey everyone, I'm working on an image up-scaling project, with a massive amount of texture files; however, I've ran into an issue where the placeholder colors on the texture palette cause interference with the up-scaling software. Placeholder colors, and the effect they have can be seen here: https://gyazo.com/d087759e04450d144e14c757cb773d95 I am not as knowledgeable about GIMP's more advanced features, but I'd want to develop a process to batch process a folder of images, and replace the impacting colors with another to resolve the issue. How would I go about this process? Explain like I am five / don't know anything about GIMP's functionality. Any help would be greatly appreciated! EDIT: I've started using Color to Alpha, which seems to work for this purpose. Just applying this as a Batch to the whole set is now the challenge. RE: Batch replace colors - rich2005 - 08-07-2020 (08-07-2020, 02:00 PM)EagleEye559 Wrote: ..snip... Without delving into the mysteries of Gimp scripting for a starter you could try the batch plugin BIMP https://alessandrofrancesconi.it/projects/bimp/ Choose other Gimp procedure, search for colortoalpha, and set the colour. [attachment=4719] ...but it is a bit of a blunt tool. It will remove the colour from everything. If that works you can add a scaling procedure. Otherwise hopefully more suggestions. RE: Batch replace colors - EagleEye559 - 08-07-2020 Thanks for the advice, I've done some quick testing with that method, and I seem to have made an error, as all the files now have a green tint applied. I'll change the approach slightly, but this appears to be a method to pursue for now. Regardless of the color being converted to Alpha, the rest of the image has it's color shifted. https://gyazo.com/281090f29317dc15090582304b4bd3d1 RE: Batch replace colors - rich2005 - 08-07-2020 That is what I meant about C2A being a blunt tool. Example: An image with a mixture of red-green-blue (as most images are) Remove one element - in this case a primary - blue and the remaining red and green combine and you also get semi-transparency. [attachment=4720] You need some other method You need to give more information. What are these 'placeholder colours'? You mentioned a texture palette, what is that ? Best if you upload a couple of typical images, maybe zipped into a file on dropbox or similar. RE: Batch replace colors - EagleEye559 - 08-07-2020 (08-07-2020, 03:47 PM)rich2005 Wrote: That is what I meant about C2A being a blunt tool. You can see an example of the textures here: https://easyupload.io/xc5um7 As each model or surface references an image, not all sectors in the image are used. Anything not used, will feature a void of color. Some of these colors directly interfere with up-scaling tools, as they border the texture. The affected outcome, is a green tint. Removing any variants of red from these placeholder voids, resolves the issues during the process. RE: Batch replace colors - rich2005 - 08-07-2020 I do not have a solution, but can I restate (as I see it) the question. Lots of individual png images, with transparency. Some with solid blocks of a colour (red?) to remove. Blocks of this colour, different sizes, different locations. Keep anything else that has a red component 'as-is' [attachment=4721] Obviously one-at-a-time with fuzzy select works. Needs a script that can search for those individual blocks. RE: Batch replace colors - Ofnuts - 08-08-2020 (08-07-2020, 06:02 PM)rich2005 Wrote: I do not have a solution, but can I restate (as I see it) the question. Assuming the placeholder color has been picked because it doesn't occur anywhere in the textures, a color selection with a very low threshold would select all the blocks. It is also possible to select only on hue. RE: Batch replace colors - rich2005 - 08-08-2020 Quote: Assuming the placeholder color has been picked because it doesn't occur anywhere in the textures, a color selection with a very low threshold would select all the blocks. It is also possible to select only on hue. I do not know. The 'red' placeholder is RGB 240,40,48 and some of the image elements do contain a fair proportion of red. Individually, not a problem, For batch, the best I get is with the gmic plugin http://www.gmic.eu using a gmic command in BIMP Code: fx_select_color 0,0,0,0,240,40,48,255,2,255,255,255,0,0,50,50 Maybe not 100% , you can see from the insets. Big block removed but tiny block remains (edit: ah just checked, different red) [attachment=4730] Tried through the 55 images provided. No earth shattering records broken. Took about 45 seconds. (from the first post, "massive amount of texture files" I wonder how massive is massive) |