Click here to Skip to main content
15,041,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am developing a windows form application in Visual studio 2013 using c#.

I need to find each pixels of a image of picturebox1 which are white and then convert them into red.

This is my pseudocode:
---------------------------------------------------
foreach(White pixels in picturebox1.Image)
{
turn the white pixels to red ;
}
----------------------------------------------------

Is this the basic idea ? If not how can i acheive it ?
Please provide some links to tutriols or articles.

Any kind of help would be appreciated.
Posted

1 solution

Yes - the simplest way is just to use Bitmap.GetPixel[^]and Bitmap.SetPixel[^] - there are faster ways of doing the processing, but they require unsafe code and pointers, so I'd get it working with these first!

Do note that "white" is an ambiguous concept: it has a specific meaning in terms of bitmaps - full R, G, and B, basically - but as far as our eyes are concerned there are a range of RBG values which appear "white" or "off white". You may find there is very little actual "white" in a random image and need to provide a "whiteness" offset of some description.
   

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