I need to operate on pixel values in images. Therefore I wrote such a class:
public class image_class
{
#region property
public int width { get; priv
You don't need all this. In order to copy a rectangular part from a source bitmap, and subsequently scale it, you might simply use a CroppedBitmap
and a TransformedBitmap
:
BitmapSource original = ...
var crop = new CroppedBitmap(original, new Int32Rect(5, 5, 50, 50));
var result = new TransformedBitmap(crop, new ScaleTransform(0.4, 0.4));