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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...