I'm working on a pixel art editor and I stuck in an issue with zooming. I created a simple zooming function which is working properly except one thing... I can't get a pixel perfect result after zooming. I think it is self-explaining and don't need any further explanation what I'm thinking. I tried the different versions of InterpolatinMode but the picture still "smooth".
private Image ZoomPicture(Image img, Size size)
{
Bitmap temp_btm = new Bitmap(img, Convert.ToInt32(img.Width * size.Width), Convert.ToInt32(img.Height * size.Height));
Graphics gpu = Graphics.FromImage(temp_btm);
gpu.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
return temp_btm;
}
Check the pictures: