zoukankan      html  css  js  c++  java
  • 创建缩略图

     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);
  • 相关阅读:
    ssm框架中的struts我的配置问题
    ssm框架web.xml中filter配置问题
    partition-list
    entity.Student@150f3932, entity.Student@1a740c6b 没有实体中的数据
    UVA 11361 Investigating Div-Sum Property
    UVA 10883 Supermean
    Gym 101081K Pope's work
    UVA 1103 How Many O's?
    HOJ 1108
    HDU 5936 朋友
  • 原文地址:https://www.cnblogs.com/gateluck/p/2105267.html
Copyright © 2011-2022 走看看