O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting an image into grayscale

The previously mentioned WriteableBitmapEx library contains a set of great built-in features. Some of them have been already described, but in this recipe you will learn how to easily convert an image into grayscale mode.

Getting ready

To step through this recipe, you only need the automatically generated project.

How to do it...

To prepare the example that loads an image and converts it into grayscale, perform the following steps:

  1. Install the WriteableBitmapEx library using the NuGet Package Manager.
  2. Add the Image.jpg file to the Assets directory.
  3. Place the Image control where the grayscale photo will be shown on the page by adjusting the content of the MainPage.xaml file, as follows:
     <Page (...)> <Grid> <Image x:Name="Photo" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required