How can I resize an image on server that I just uploaded? I using C# with .NET Framework 3.5 SP1.
Thanks!
How can I resize an image on server that I just uploaded? I using C# with .NET Framework 3.5 SP1.
Thanks!
On
the snippet I always use:
var target = new Bitmap(size.Width, size.Height, PixelFormat.Format24bppRgb);
target.SetResolution(source.HorizontalResolution,
source.VerticalResolution);
using (var graphics = Graphics.FromImage(target))
{
graphics.Clear(Color.White);
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.DrawImage(source,
new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(sourceX, sourceY, source.Width, source.Height),
GraphicsUnit.Pixel);
}
return target;
Try the following method: