Category Archives: image processing

Convert a bitmap into a cursor in C#

Converting a bitmap into a cursor isn’t easy, but you can do it by using the CreateIconIndirect API function. This example uses the following BitmapToCursor method to create a cursor from a bitmap. // Create a cursor from a bitmap. … Continue reading

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

Use a bitmap for an icon in C#

You can’t set a form’s Icon property equal to a bitmap. Fortunately it’s easy enough to create an icon from a bitmap. This example uses the following code to make a form’s icon display the image in a bitmap. // … Continue reading

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

Make a tool that creates PNG files with transparent backgrounds in C#

When you use the File menu’s Open command, the following code lets you select a image file. // The image. private Bitmap Bm = null; // Offset for displaying the image. private const int Offset = 10; // Open a … Continue reading

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

Give an image a transparent background in C#

The Bitmap class’s MakeTransparent method changes all of the pixels with a given color to the transparent color A = 0, R = 0, G = 0, B = 0. When the program starts, the following code makes the background … Continue reading

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

Use BeginInvoke and callbacks to perform tasks asynchronously in C#

The example Use BeginInvoke and EndInvoke to perform tasks asynchronously in C# explains one way to call a method asynchronously so it can run on a separate core or CPU. In that example, the program calls BeginInvoke several times to … Continue reading

Posted in algorithms, graphics, image processing, threading | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Use BeginInvoke and EndInvoke to perform tasks asynchronously in C#

This example uses the Emboss method to create embossed images. How that method works isn’t important to the discussion of working asynchronously so it isn’t covered here. Download the example to see how it works. The only thing about that … Continue reading

Posted in algorithms, graphics, image processing, threading | Tagged , , , , , , , , , , , , , | Leave a comment

Apply a color threshold to an image in C#

The example Provide gamma correction for an image in C# uses the ImageAttribute object’s SetGamma method to gamma correct an image. This example uses the SetThreshold method to apply a color threshold to an image. The SetThreshold method takes as … Continue reading

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

Adjust image translucency in C#

The example Use an ImageAttributes object to adjust an image’s brightness in C# uses a ColorMatrix object to scale the red, green, and blue color components of an image’s pixels. You can use a similar technique to scale the pixels’ … Continue reading

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

Provide gamma correction for an image in C#

Gamma correction, or just gamma, is a nonlinear change to the red, green, and blue components of the pixels in an image. The post Use an ImageAttributes object to adjust an image’s brightness in C# explains how to use ImageAttributes … Continue reading

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

Display thumbnails for image files in a directory in C#

This example shows how to display thumbnails for the images in a directory. It displays a tooltip when the mouse hovers over a picture and it opens the image file in the default application if you double-click on an image. … Continue reading

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