I am having a problem converting BitmapImage (WPF) to grayscale while preserving the alpha channel. The original image is PNG.
The MSDN article works fine here , but it removes the alpha channel.
Is there a quick and efficient way to convert BitmapImage to grayscale?
You should take a look at image conversion using matrices.
, , ColorMatrix. ( VB.NET, #).
ColorMatrix
, -, , , .
PixelFormat. , PixelFormats.Bgra32 , PixelFormats.Gray16. Gray16 . 65535 , .
PixelFormat
PixelFormats.Bgra32
PixelFormats.Gray16
Gray16
. - Bgra32 , . , -. , 8- - ( ).
Bgra32
- , PixelFormats.Indexed8, , , , . , ( ), 1 255.
PixelFormats.Indexed8
API . " ": RGBA , RGBA MMMA, M = (R + G + B)/3;
, , RGB. , , .
, ShaderEffect . , . , . , . , , .
HLSL LOB.:)