Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Okay! I almost done all the kinds of searching anywhere and I ended up asking it here.

I only have just one 1 question.

Let just say I have a picturebox that contains an image of a Hair(Curly Hair) with a white background and 3 Buttons (Red,Green and Blue). If I press the Red Button the Hair inside the picturebox will change to red (Do not include the white BG).

How can i create a code of it? Can i have an Example? TY in advance :D

It sounds like this is homework. But why not help also a little bit on this.

RGB is a color space (not well defined expect you refer sRGB and unfortunately also sRGB meanwhile is not longer defined in a unique way). For now you can forget the remark in the last bracket.

R= G= B= 0 means black.
R= G= B= 255 means white.

In case you are really in the lucky position that your background is exactly “RGB-white” you need only to set each point where R < 255 && G < 255 && G < 255 to the color the user choose. This assumes of course that you know how to access each pixel of the pic.

But please be aware that the white background is maybe not that perfect. Then it is better to replace the 255 mentioned above by a selectable limit.

And by the way, each pixel of the curly hairs which is white, remain “white” in this easy solution.
Share this answer
Search the articles here for "Image processing for dummies" and you'll come up with the basic tools you need to pull this little project off.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900