Kamal Bhardwaj
Kamal Bhardwaj

Reputation: 948

replace all red pixels in apple image with green green, including gradient red ios

I am doing change color of my apple shown below:

enter image description here

to change all red colors to green and all yellow to orange. My problem is how to select all kind of red color and how to select all kind of yellow to apply new effect or color.

Any help please.

Thanks

Upvotes: 3

Views: 1368

Answers (1)

Marcus Adams
Marcus Adams

Reputation: 53870

The easiest way to do this is to convert the RGB colors to HSB/HSV (Hue, Saturation, Brightness/Value). The hue value is the color.

For converting red to green, for instance, you'll want to figure out which numeric hue value represents red and which one represents green, then figure out a threshold. For every pixel where the hue is close to red (within your threshold), you move the hue to green.

Upvotes: 2

Related Questions