解决方法"/>
打印图像模糊问题解决方法
思路:核心 图像转换
1、修改图像dpi值
2、使用高质量的双三次插值法
3、指定高质量
C# Code 、如下:
/// <summary>/// 图像质量提升 解决打印模糊问题/// </summary>/// <param name="sourceimg"></param>/// <param name="dpiX"></param>/// <param name="dpiy"></param>/// <returns></returns>private Bitmap ImageQualityUp(Image sourceimg, float dpiX, float dpiy){// 创建画布Bitmap bmp = new Bitmap(currentBitmap.Width, currentBitmap.Height, PixelFormat.Format24bppRgb);bmp.SetResolution(dpiX, dpiy);using (Graphics g = Graphics.FromImage(bmp)){// 用白色清空 g.Clear(Color.White);// 指定高质量的双三次插值法。执行预筛选以确保高质量的收缩。此模式可产生质量最高的转换图像。 g.InterpolationMode = InterpolationMode.HighQualityBicubic;// 指定高质量、低速度呈现。 g.SmoothingMode = SmoothingMode.HighQuality;// 在指定位置并且按指定大小绘制指定的 Image 的指定部分。 g.DrawImage(currentBitmap, new Rectangle(0, 0, currentBitmap.Width, currentBitmap.Height),new Rectangle(0, 0, currentBitmap.Width, currentBitmap.Height), GraphicsUnit.Pixel);}return bmp;}
更多推荐
打印图像模糊问题解决方法
发布评论