Last post Feb 20, 2008 02:36 PM by shieldo
May 18, 2007 05:13 PM|Sam964|LINK
Does anybody know how we can implement the functionality of cropping images in an asp.net application? I would like to do this in C# and I am unable to find any good samples. Can anybody please give me pointers as to how this can be implemented. I am not
sure whether there are some controls already written..
Thanks a lot
May 18, 2007 06:37 PM|Girijesh|LINK
May 18, 2007 06:38 PM|Girijesh|LINK
May 21, 2007 12:42 PM|Sam964|LINK
Does this allow me to specify a rectangular area on the image and then crop that part? This seems like it takes an input height and width to crop, but I would like to implement smth which allows the user to crop the image in the browser by selecting an area
in the image.
Thanks a lot!!
Feb 18, 2008 09:29 AM|shieldo|LINK
Any chance of a link that isn't dead?
Feb 20, 2008 01:55 PM|sduffy77|LINK
This is what I use
private static System.Drawing.Bitmap CropImageFile(System.Drawing.Image imageFile, int targetW, int targetH, int targetX, int targetY)
System.Drawing.Bitmap bmpRtn = new System.Drawing.Bitmap(imageFile);
System.Drawing.Image imgPhoto = imageFile;
System.Drawing.Bitmap bmPhoto = new System.Drawing.Bitmap(targetW, targetH, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
System.Drawing.Graphics grPhoto = System.Drawing.Graphics.FromImage(bmPhoto);
grPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
grPhoto.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
grPhoto.DrawImage(imgPhoto, new System.Drawing.Rectangle(0, 0, targetW, targetH), targetX, targetY, targetW, targetH, System.Drawing.GraphicsUnit.Pixel);
bmpRtn = bmPhoto;
Feb 20, 2008 02:36 PM|shieldo|LINK
Thanks for the post! I already figured out something that worked for me, fortunately.