c#生成缩略图代码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

public void SaveThumbnail(string path, string thumbnailPath, int newWidth, int newHeight)
{
    System.Drawing.Image i = System.Drawing.Image.FromFile(path);
    System.Drawing.Image thumbnail = new System.Drawing.Bitmap(newWidth, newHeight);
    System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumbnail);
    g.DrawImage(i, 0, 0, newWidth, newHeight);
    thumbnail.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
}