该死的代码
三聪的博客
posts - 25,comments - 92,views - 64664
复制代码
 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);
复制代码
posted on   三聪  阅读(209)  评论(0编辑  收藏  举报
< 2011年7月 >
26 27 28 29 30 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 1 2 3 4 5 6

作者:gateluck
出处:http://gateluck.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
点击右上角即可分享
微信分享提示