How can I change all pixels of one color to another color in a picture?

8

1

I have an image which looks like this:

Enter image description here

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?

user29116

Posted 2010-04-05T09:42:17.607

Reputation: 91

Answers

5

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

enter image description here

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.

Journeyman Geek

Posted 2010-04-05T09:42:17.607

Reputation: 119 122

Could you please elaborate, step-by-step, for someone who has installed but isn't familiar with Paint.NET? – Kenny LJ – 2015-08-27T01:57:29.097

1Added a quick gif and explanation. Its pretty simple, assuming you're starting with a clean image. The global vs contiguous option also exists for the magic wand tool, which can be useful, especially if you play around with tolerances. – Journeyman Geek – 2015-08-27T12:38:26.920

3

Ignacio Vazquez-Abrams

Posted 2010-04-05T09:42:17.607

Reputation: 100 516

2

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:

http://www.agentur-simon.de/pedit/

Also, you say you use irfanview, there's a plugin:

http://www.ivanview.com/pal.html

S.gfx

Posted 2010-04-05T09:42:17.607

Reputation: 1 643

1

Pick an image editing program like Photoshop or GIMP (latter one is free), and paint the line with "Color" mode.

petersohn

Posted 2010-04-05T09:42:17.607

Reputation: 2 554

Gimp has select by color, which you can then fill with a different color. – Chris K – 2012-06-19T23:44:40.897

0

The free 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:

screenshot

Advanced:

screenshot

Replace Color:

screenshot

You can select a tolerance (the higher the number, the looser the match).

whiskeychief

Posted 2010-04-05T09:42:17.607

Reputation: 180