Pages

Subscribe:

Ads 468x60px

Thursday, March 8, 2012

How to crop image in asp.net using c#

In this asp.net web programming tutorial we will learn how to crop an image in asp.net using c# see the below code it will help us how to do cropping.

Give the Image and location x,y with width and height....
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