Hi there I want to resize my image and save it by fileupload in my path.
I found this code:
public static System.Drawing.Image ResizeImage(System.Drawing.Image sourceImage, int width, int height)
{
System.Drawing.Image oThumbNail = new Bitmap(sourceImage, width, height);
Graphics oGraphic = Graphics.FromImage(oThumbNail);
oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
Rectangle oRectangle = new Rectangle(0, 0, width, height);
oGraphic.DrawImage(sourceImage, oRectangle);
return oThumbNail;
}
now how can I show this image?
like Image1.....=ResizeImage(....)
what should i write?
vahid.ch
Member
294 Points
331 Posts
Resize Image
Jan 15, 2012 09:33 AM|LINK
Hi there I want to resize my image and save it by fileupload in my path.
I found this code:
public static System.Drawing.Image ResizeImage(System.Drawing.Image sourceImage, int width, int height) { System.Drawing.Image oThumbNail = new Bitmap(sourceImage, width, height); Graphics oGraphic = Graphics.FromImage(oThumbNail); oGraphic.CompositingQuality = CompositingQuality.HighQuality; oGraphic.SmoothingMode = SmoothingMode.HighQuality; oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic; Rectangle oRectangle = new Rectangle(0, 0, width, height); oGraphic.DrawImage(sourceImage, oRectangle); return oThumbNail; } now how can I show this image? like Image1.....=ResizeImage(....) what should i write?sudeep_13
Contributor
2549 Points
512 Posts
Re: Resize Image
Jan 15, 2012 02:45 PM|LINK
Hi,
Pls refer below link
http://weblogs.asp.net/gunnarpeipman/archive/2009/04/02/resizing-images-without-loss-of-quality.aspx
Please mark the post as "Answer" if it helps you.