如何在C#中调整图像大小而不进行平滑处理 [英] How to resize image in C# without smoothing

查看:149
本文介绍了如何在C#中调整图像大小而不进行平滑处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不影响平滑的情况下调整黑白图像的尺寸?我的BarCode图像太大.我需要调整图像大小,但要注意一点.生成的图像必须具有相同的比例大小,并且黑色和白色条不能变成黑色,灰色和白色条(我相信这是由于发生了一些平滑处理).如何在c#中执行此操作的任何示例??

How do you re-size a black and white image without any smoothing affect? I have a BarCode that is an image that is too big. I need to resize the image but with one caveat. The resulting image needs to be the same proportional size and the black and white bars can not turn into black,grey and white bars(which I believe is due to some smoothing occuring). Any example of how to do this in c#??

推荐答案

@arul是正确的.具体来说,

@arul is correct. To be specific,

graphics.SmoothingMode = SmoothingMode.None;
graphics.DrawImage( barCodeImage, new Point( 0, 0 ) );

您可能还想检查一下InterpolationMode,以查看是否更改此值可以使您的结果更接近您想要的结果.

You might also want to check out the InterpolationMode, to see whether changing this value gives you results closer to what you want.

这篇关于如何在C#中调整图像大小而不进行平滑处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆