I have an image which is 6000px*4000px. I want it to be 5550px*4000px. I dont want to resize it, I want to take a part of the original image. In the following image, you can see what I want. I have the red image and i want to get the black. Image for visial aid.
I have following code:
public static Bitmap CutImage(Image image)
{
Bitmap source = new Bitmap(image);
Bitmap cuttedImage = source.Clone(new System.Drawing.Rectangle(250, 0, 5550, 4000), source.PixelFormat);
return cuttedImage;
}
The code throws an Out of Memory Exception. This post: C# Image.Clone Out of Memory Exception says: "Clone() may also throw an Out of memory exception when the coordinates specified in the Rectangle are outside the bounds of the bitmap."
Does anybody know what my problem is?
Thanks for helping!