Cut a selection of a Bitmap

  • Thread starter Thread starter André Borchert
  • Start date Start date
A

André Borchert

Hello,

how do you select a region (area = x1,y1,x2,y2) of a bitmap and cut or copy
this selection into a new bitmap ?
The original could be a Bitmap object or a Image/PictureBox object.
However, the selected area has to be a new image as I make some Pixel
calculations with the selected area only, while the original image keeps
untouched.

Regards,

André
 
Try using one of the Clone methods on the Bitmap object.
I'm thinking you can use the one that specifies a Rect and
Pixel Format. The Clone returns a new BitMap object with
the specified rectangle.

Should be okay from there to do whatever you want with it.
Just make sure your calling Dispose on these GDI+ objects.
 
Back
Top