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);
        }

No comments:

Post a Comment

 

Sample text

Sample Text