Ian Newson
Ian Newson

Reputation: 7949

Graphics.DrawImage scaling method?

Given the following code:

    var target = new Bitmap(source.Size.Width / 2, source.Size.Height / 2);
    using (var g = Graphics.FromImage(target))
    {
        g.DrawImage(source, new Rectangle(Point.Empty, target.Size));
        g.Save();
        return target;
    }

What scaling method does 'DrawImage' use? Is it an average of 4 pixels? The value at {0,0)? Can I adjust this behaviour?

Thanks!

Upvotes: 3

Views: 685

Answers (1)

JosephDaSilva
JosephDaSilva

Reputation: 1187

You can set the value of the Graphics.InterpolationMode property to the interpolation method that you want to use. This must be done before you call DrawImage.

Upvotes: 2

Related Questions