public Resize ( int newWidth, int newHeight ) : System.Windows.Media.Imaging.BitmapSource | ||
newWidth | int | |
newHeight | int | |
return | System.Windows.Media.Imaging.BitmapSource |
public BitmapSource Resize(int newWidth, int newHeight) {
Image newImage = new Bitmap(newWidth, newHeight);
using (Graphics graphicsHandle = Graphics.FromImage(newImage)) {
graphicsHandle.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphicsHandle.DrawImage(Bitmap, 0, 0, newWidth, newHeight);
}
return new SharedBitmapSource(newImage as Bitmap);
}