Convert a dynamic BitmapImage to a grayscale BitmapImage in a Windows Phone application

后端 未结 3 787
误落风尘
误落风尘 2021-01-24 01:14

I would like to Convert a BitmapImage to a Grayscale BitmapImage: Which I get from a method and therefore - the Width and Height are unknown to me. I have tried looking into opt

3条回答
  •  终归单人心
    2021-01-24 01:45

    Not sure of the namespaces here but something like this may work:

    using System;
    using System.Windows;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    
    FormatConvertedBitmap bitmapGreyscale = new FormatConvertedBitmap(bitmap, PixelFormats.Gray8, BitmapPalettes.Gray256, 0.0);
    

提交回复
热议问题