Jump to content
Software FX Community

Copy some piece of bit map on another bit map


SarahBenjamin

Recommended Posts

Try using the DrawImageUnscaledAndClipped() method of the Graphics object. You will have to create a bitmap where the clipped region will be drawn to, and a rectangle that defines which region to clip. The sample code below can give you an idea of what you need to do:

Image img = Image.FromFile("D:\\Beach.jpg");

Bitmap bmp = new Bitmap(img.Width, img.Height);Rectangle clipRect = new Rectangle(45, 175, 300, 150);

Graphics g1 = Graphics.FromImage((Image)bmp);

g1.DrawImageUnscaledAndClipped(img, clipRect);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...