static RawBitmap desaturate(BitmapSource bitmap) { var raw = new RawBitmap(bitmap); var hsl = Hsla32.FromPbra32(raw.Data, raw.Width).Desaturate(0.87F, 1e-2F); return(raw.CloneWithData(Rgba32.FromHsl(hsl))); }