Social Icons

Thursday, March 8, 2012

How to crop image in c#

Give the Image and location x,y with width and height and get the croped image

Rectangle srcRect = new Rectangle(LocX, Locy, width, heigth);

 private static Image cropImage(Image img, Rectangle cropArea)
        {
            Bitmap bmpImage = new Bitmap(img);
            Bitmap bmpCrop = bmpImage.Clone(cropArea,
            bmpImage.PixelFormat);
            return (Image)(bmpCrop);
        }

1 comment:

  1. Thanks for this helpful Blog.
    I used a WordPress plugin that I found interesting. So I would like to recommend it.
    The plugin helps me quickly create and customize images before inserting them in my blog post.
    Check at: https://getpikiz.com/wordpress-plugin/
    It’s free.

    ReplyDelete

 

Sample text

Sample Text