110,534
社区成员
发帖
与我相关
我的任务
分享
string directory = @"你写个路径";
Bitmap bmp = new Bitmap(640,480);
Graphics g = Graphics.FromImage(bmp);
foreach (var path in Directory.GetFiles(directory))
{
Image img = Image.FromFile(path);
g.DrawImage(img, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
img.Dispose();
bmp.Save(path);
}
g.Dispose();
bmp.Dispose();