public Bitmap ResizeBitmap(Bitmap initialBitmap,int width,int height)
{
try
{
Bitmap templateImage = new System.Drawing.Bitmap(width, height);
Graphics templateG = Graphics.FromImage(templateImage);
templateG.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
templateG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
templateG.Clear(Color.White);
templateG.DrawImage(initialBitmap, new Rectangle(0, 0, width, height), new Rectangle(0, 0, initialBitmap.Width, initialBitmap.Height), GraphicsUnit.Pixel);
return templateImage;
}
catch(Exception ex)
{
throw ex;
}
}
C#简单放大缩小图像并保存文件
最新推荐文章于 2020-03-03 09:57:21 发布