图像调整大小后的奇怪边框C#

时间:2017-06-08 14:08:57

标签: c# .net image image-resizing

我试图调整图像大小而不会失去质量。我使用here

中的代码
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));
}

但是我遇到了一个奇怪的问题:图像周围有一个1px的边框。

原始图片: Original image

调整大小: enter image description here

不容易看到它,但是当您缩放图像时,您可以记录它,尤其是在左上角。

如何摆脱它?有什么问题?

THX!

0 个答案:

没有答案
相关问题