Image enlarging quality
-
I'm having problems enlarging images using the Graphics object. The quality of the enlarged images is bad. I get the best results by setting the interpolation mode to nearest neighbor and pixel offset mode to high quality. Even then, the image is grainy. Here's an example: protected override void OnPaint(PaintEventArgs e) { if(this.image != null) { RectangleF source = new RectangleF(0f,0f,0f,0f) RectangleF dest = new RectangleF(0f,0f,0f,0f) dest.X = e.ClipRectangle.X; dest.Y = e.ClipRectangle.Y; dest.Width = e.ClipRectangle.Width; dest.Height = e.ClipRectangle.Height; source.X = dest.X / zoom; source.Y = dest.Y / zoom; source.Width = dest.Width / zoom; source.Height = dest.Height / zoom; e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; e.Graphics.DrawImage(image, dest, source, GraphicsUnit.Pixel); } if(deleg != null) deleg(this, e); base.OnPaint(e); } Basically, what I'm looking for is something like a simple pixel resize. I've tried doing this manually, but with bigger images it takes a lot of resources. Any ideas?