110,533
社区成员
发帖
与我相关
我的任务
分享
public Bitmap BitSized(Bitmap bitmap, int iSize_Width,int iSize_Height)
{
Bitmap originBmp = bitmap;
int w = iSize_Width;
int h = iSize_Height;
Bitmap resizedBmp = new Bitmap(w, h);
Graphics g = Graphics.FromImage(resizedBmp);
//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
//消除锯齿
g.SmoothingMode = SmoothingMode.AntiAlias;
g.DrawImage(originBmp, new Rectangle(0, 0, w, h), new Rectangle(0, 0, originBmp.Width, originBmp.Height), GraphicsUnit.Pixel);
g.Dispose();
resizedBmp.Dispose();
originBmp.Dispose();
return originBmp;
}
这是图片转换大小的代码,虽然能够转换 但是打印质量还是不行