I have a problem with image scaling in .NET. I use the standard Graphics type to resize images like in this example:
public static Image Scale(Image sourceIm
How does the following work for you? This is the code I've used to do the same thing. The main difference I notice is that I don't use SetResolution (and I assume a square input and output, since that was the case for me).
///
/// Resizes a square image
///
/// Image to resize
/// Width and height of new image
/// A scaled version of the image
internal static Image ResizeImage( Image OriginalImage, int Size )
{
Image finalImage = new Bitmap( Size, Size );
Graphics graphic = Graphics.FromImage( finalImage );
graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
Rectangle rectangle = new Rectangle( 0, 0, Size, Size );
graphic.DrawImage( OriginalImage, rectangle );
return finalImage;
}