打印图像模糊问题解决方法

编程入门 行业动态 更新时间:2024-10-09 23:16:29

打印图像模糊问题<a href=https://www.elefans.com/category/jswz/34/1770089.html style=解决方法"/>

打印图像模糊问题解决方法

思路:核心 图像转换
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;}

更多推荐

打印图像模糊问题解决方法

本文发布于:2023-06-22 02:21:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/826340.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方法   图像   模糊

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!