C# 的隨手筆記 1 - Bitmap 修改 Size

將原本的圖片修改成另一個大小

 

img1 輸出 修改的大小

private static Bitmap ResizeImage(Bitmap img1, int ReSize_W1, int ReSize_H1)
{
    Bitmap img_out = new Bitmap(ReSize_W1, ReSize_H1);
    Graphics g = Graphics.FromImage((System.Drawing.Image)img_out);
    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    g.DrawImage(img1, 0, 0, ReSize_W1, ReSize_H1);
    g.Dispose();
    return img_out;
}