How to resize an Image C#

前端 未结 17 2415
暗喜
暗喜 2020-11-21 22:28

As Size, Width and Height are Get() properties of System.Drawing.Image;
How can I resize an Image object

17条回答
  •  别那么骄傲
    2020-11-21 23:05

    public static Image resizeImage(Image image, int new_height, int new_width)
    {
        Bitmap new_image = new Bitmap(new_width, new_height);
        Graphics g = Graphics.FromImage((Image)new_image );
        g.InterpolationMode = InterpolationMode.High;
        g.DrawImage(image, 0, 0, new_width, new_height);
        return new_image;
    }
    

提交回复
热议问题