Partially change the color of an image in C#

The goal is to change the color a particular part of an image dynamically in C#. For example, in the picture below, I want to change the color of the sleeve only:

You could use some sort of pixel matching technique; search the image pixel by pixel to find the area you want but this is not trivial.

My solution is basically to split the picture in different areas, the one that won’t suffer color change, and the one(s) that will, like this:

Now I can use the methods described in my other article, to swap the color of the picture I want.

Then, use the method described in this other article, to combine both pictures into one.

You can download the image files used in this example here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s