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);
}
结果是在左上角方向偏移了几个像素的放大图像。
我该如何做到这一点?