I'm trying to crop an image:

Bitmap bmp = (Bitmap)pictureBox1.Image;
Bitmap cBmp = bmp.Clone(croppedAreaRectangle, bmp.PixelFormat);
pictureBox1.Image = cBmp;
bmp.Dispose();

It's partly working, but the image result is smaller, and from a different area out side the selected cropped area.


So what's wrong?

the image returned will be the same size as the rectangle it was cropped from, not the original image, as for any other problem. you might want to look at how the cropping rectangle is created.

The code you have posted looks sound, there is no reason why it shouldn't work, aside from the croppedAreaRectangle. that's probably where the problem is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.