Tag Archives: GetPixel

Count pixels of different colors in C#

The following CountPixels method counts pixels in an image that match a target color. // Return the number of matching pixels. private int CountPixels(Bitmap bm, Color target_color) { // Loop through the pixels. int matches = 0; for (int y … Continue reading

Posted in algorithms, graphics, image processing | Tagged , , , , , , , , , , | 6 Comments

Draw a colorful color wheel in C#

The example Draw a color wheel in C# draws a color wheel. To do that, it makes a series of points along the perimeter of a circle where each point has a different color of the rainbow. It then makes … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , , , | 5 Comments

Draw a color wheel in C#

The program uses a PathGradientBrush to fill a color wheel with color samples. Drawing the wheel is basically automatic but takes some effort to set up. The following DrawColorWheel method draws does all the work. // Draw a color wheel … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , , , | Leave a comment

Use the Bitmap32 class to manipulate image pixels very quickly in C#

The following posts explain how you can build a Bitmap24 class to manipulate the pixels in 24-bit images very quickly. Use the Bitmap24 class to manipulate image pixels very quickly in C# Add GetPixel and SetPixel methods to the Bitmap24 … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , | 9 Comments

Add GetPixel and SetPixel methods to the Bitmap24 class in C#

This example adds GetPixel and SetPixel methods to the Bitmap24 class described in the post Use the Bitmap24 class to manipulate image pixels very quickly in C#. Unfortunately that class only allows you manipulate pixel values in a one-dimensional byte … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , | 1 Comment

Use the Bitmap24 class to manipulate image pixels very quickly in C#

The Bitmap class’s GetPixel and SetPixel methods let you easily manipulate image pixels. They’re easy to use, but they’re also relatively slow. This program inverts the pixels in an image several times. When you click the No Lock Bits button, … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , , | 5 Comments