Tag Archives: image processing

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

Draw a smiley face with WPF in C#

Often I need to use images for demonstration purposes or for a book, and a smiley face makes a neutral, pleasant image. This example shows how to draw a smiley face with XAML and WPF, and then save an image … Continue reading

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

Rotate images that are scaled in C#

The example Interactively rotate images in C# lets you click and drag to rotate images but it doesn’t always work well if the image you are rotating is too big to fit on the screen. The example Rotate images inside … Continue reading

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

Rotate images inside a scrolled panel in C#

The example Interactively rotate images in C# lets you click and drag to rotate images. Unfortunately it doesn’t work well with images that are too big to fit on the screen. If an image is too big, the program lets … Continue reading

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

Give transparent backgrounds to images displayed on buttons in C#

This example shows how to give transparent backgrounds to the images displayed on a button. If you give buttons images that have transparent backgrounds, then the button’s background can show through. If the images don’t have transparent backgrounds, the result … Continue reading

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

Display the Astronomy Picture of the Day on the desktop in C#

This example combines the techniques from the following two posts: Download the Astronomy Picture of the Day in C# Set the Windows desktop picture in C# This example uses two settings, LastLoadTime and LastUrl, to determine whether it is a … Continue reading

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

Download the Astronomy Picture of the Day in C#

Each day the Astronomy Picture of the Day web page does exactly what you would expect: it displays a different astronomy picture. The pictures include planets, nebulae, spacecraft, and other astronomy-related images, and the page includes an explanation of the … Continue reading

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

Randomly change the desktop picture in C#

The example Set the Windows desktop picture in C# shows how to display an image on the desktop. This example periodically changes the desktop picture to a randomly selected image file picked from a directory. Note that recent versions of … Continue reading

Posted in API, graphics, image processing, interoperability, system | Tagged , , , , , , , , , , , , , , , | Leave a comment

Set the Windows desktop picture in C#

This example sets the Windows desktop picture much as you can manually in Windows 10. (I can’t guarantee that it will work without any changes in other versions of Windows.) Exactly how you set the desktop picture manually depends on … Continue reading

Posted in API, graphics, interoperability, system | Tagged , , , , , , , , , , , , , , , | Leave a comment

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