public static BitmapSource ApplyDiscreteCosineTransform(BitmapSource bitmap, object parameter) { var dctParameters = (DctParameters)parameter; var encoded = DctAlgorithm.ApplyDct(bitmap, dctParameters); Jpeg.Save(encoded, dctParameters); return(null); }