I have an image which looks like this:
However, the yellow line needs to be red and the cyan line needs to be green. I have Paint and IrfanView. How can I change the colors of the yellow and cyan line without individually selecting all pixels manually?
That is, what is a good way of changing all pixels of one color to another color?
5 Answers
Paint.NET will do it, You just need to do a fill, with 'global' mode instead of contiguous mode.
As per request. I'd note the original was horribly noisy and I cleaned it up a bit. You'd ideally want to clean this up first
There's a few important things here.
Firstly, I was zoomed into the image so I could pick the correct area more easily. There was a ton of anti-aliasing here so I ended up sharpening it (or otherwise cleaning it up), but even then, I went with a fairly high tolerance (The higher the tolerance, the less similar an adjoining pixel needs to be to its neighbours to be recoloured) Play with that value - lower is more 'precise' but you may need a higher value.
2ImageMagick can do all sorts of fancy color replacements.
In games, many years ago we used *.PAL file editors to change one color per another. This is mostly for if your images are color indexed. (IE: Gifs are always color indexed)
It was used (also did again while doing mobile games) to change cloth colors so to make different enemies using only the memory in disk of a single one.
There are many tools, but as an example:
Also, you say you use irfanview, there's a plugin:
1The free (gratis) tool IrfanView has a tool do do this, and it will even do Batch processing (several files, or an entire folder, at once).
Go to File: Batch Conversion, then hit Advanced, then "Replace Color".
Batch Conversion:
Advanced:
Replace Color:
You can select a tolerance (the higher the number, the looser the match).
1Pick an image editing program like Photoshop or GIMP (latter one is free), and paint the line with "Color" mode.
1