Tag Archives: Bitmap

Use an animated cursor in C#

This example doesn’t show how to use an animated cursor file such as an animated gif or png file. As far as I know, C# doesn’t support that kind of cursor. What this example does do is show how to … Continue reading

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

Make light pixels transparent in an image in C#

Recently I had an image and I wanted to make all of the light pixels transparent. Ideally I could simply make the white pixels transparent, but the image was scanned so few of the pixels were pure white. What I … Continue reading

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

Convert a metafile into a PNG file in C#

A metafile (WMF file) contains drawing commands that tell a program how to produce an image. This is very useful and allows you to resize the image without producing ugly anti-aliasing effects, but sometimes you may want a raster image … Continue reading

Posted in drawing, files, graphics, image processing | Tagged , , , , , , , , , , , , | 2 Comments

Display a Windows metafile (wmf) in C#

A Windows metafile (wmf) is an image file that contains instructions for drawing shapes. In contrast, bitmap, PNG, JPG, and other raster image files indicate exactly what colors individual pixels should have. Because a Windows metafile contains drawing instructions instead … Continue reading

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

Warp images arbitrarily in C#, Part 2

The post Warp images arbitrarily in C#, Part 1 explains how to warp images, but it omits the method that maps an output pixel (x1, y1) back to an input pixel (x0, y0) in the original image. This post describes … Continue reading

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

Warp images arbitrarily in C#, Part 1

This is an extension of the example Use image filters to perform edge detection, smoothing, embossing, and more in C# that adds new features that warp images in arbitrary ways. The idea is to use two functions F(x, y) and … Continue reading

Posted in algorithms, graphics, image processing, mathematics | Tagged , , , , , , , , , , , , , , , , , , , | 3 Comments

Rotate a picture in C#

I recently returned from a trip and one particular picture was rotated just a tiny bit from where I wanted it. Normally I wouldn’t care but this picture (a small version is included in the download) has horizontal features at … Continue reading

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

Set the pixels in a WPF bitmap in C#

This example shows how you can manipulate the pixels in a WPF bitmap. One of the things I like least about WPF is the way Microsoft threw away everything we had learned over years of working with Visual Studio. Yes, … Continue reading

Posted in graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , | 4 Comments

Render text onto a RenderTargetBitmap with WPF and C#

In earlier examples such as Easily render rotated text in a WPF program using C#, I explained how to render text in a WPF program. Those examples draw text on the program’s window at runtime. Sometimes you may want to … Continue reading

Posted in drawing, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , , | 3 Comments

Draw on a bitmap in C#

This example shows how you can draw on a bitmap and display the result on a form. The example Draw in a Paint event handler in C# shows how to draw in a form’s Paint event handler. This is simple, … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , | 4 Comments