不用平滑来升级位图是不准确的,如何使其正确?

时间:2012-05-15 17:39:36

标签: c# image scaling system.drawing

Bitmap outputBitmap = new Bitmap(inputBitmap.Width * 5, inputBitmap.Height * 5);

using (Graphics graphics = Graphics.FromImage(outputBitmap))
    {                        
    graphics.CompositingQuality =
        System.Drawing.Drawing2D.CompositingQuality.HighQuality;
    graphics.InterpolationMode =
        System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
    graphics.SmoothingMode =
        System.Drawing.Drawing2D.SmoothingMode.HighQuality;

    graphics.DrawImage(inputBitmap, 0, 0,
        inputBitmap.Width * 5, inputBitmap.Height * 5);
    }

结果是在左上角方向偏移了几个像素的放大图像。 what it should look like and what it looks like

我该如何做到这一点?

0 个答案:

没有答案