调整图像大小不会失去任何质量 [英] Resizing an Image without losing any quality

查看:141
本文介绍了调整图像大小不会失去任何质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调整图像,但图像质量不能受此影响。

I need to resize an image, but the image quality cannot be affected by this.

推荐答案

作为<一个href=\"http://stackoverflow.com/questions/87753/resizing-an-image-without-losing-any-quality#87763\">rcar说,你不能没有失去一些质量最好的你可以在C#中做的是:

As rcar says, you can't without losing some quality, the best you can do in c# is:

Bitmap newImage = new Bitmap(newWidth, newHeight);
using (Graphics gr = Graphics.FromImage(newImage))
{
    gr.SmoothingMode = SmoothingMode.HighQuality;
    gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
    gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
    gr.DrawImage(srcImage, new Rectangle(0, 0, newWidth, newHeight));
}

这篇关于调整图像大小不会失去任何质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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