减少图像的尺寸

use*_*182 0 c# image

如何在C#中减小图像的尺寸?我在.NET 1.1中工作.

示例:将尺寸800x600减小到400x400

Ars*_*yan 5

看到这里

public Image ResizeImage( Image img, int width, int height )
{
    Bitmap b = new Bitmap( width, height ) ;
    using(Graphics g = Graphics.FromImage( (Image ) b ))
    {       
         g.DrawImage( img, 0, 0, width, height ) ;
    }

    return (Image ) b ;
}
Run Code Online (Sandbox Code Playgroud)