创建缩略图

 string file = files[i];
                Image img 
= Image.FromFile(file);
                
int width = img.Width;
                
int height = img.Height;
                
if (width > height)
                {
                    width 
= 800;
                    height 
= width * img.Height / img.Width;
                }
                
else
                {
                    height 
= 800;
                    width 
= height * img.Width / img.Height;
                }
                Bitmap bt 
= new Bitmap(width, height);
                Graphics g 
= Graphics.FromImage(bt);
                g.DrawImage(img, 
00, width, height);
                
//g.Save(
                
//Image small = img.GetThumbnailImage(width, height, null, IntPtr.Zero);

                bt.Save(
string.Format("{0}m{1}.jpg", topath, i.ToString("0000")), ImageFormat.Jpeg);
原文地址:https://www.cnblogs.com/gateluck/p/2105267.html