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);
  • 相关阅读:
    日志配置
    Mybaties核心配置文件
    配置3
    写了两个数据获得方式----费劲周折
    applicationContext
    配置2
    Django-缓存的配置
    RabbitMQ的工作模式
    centos下保留python2安装python3
    python位运算
  • 原文地址:https://www.cnblogs.com/gateluck/p/2105267.html
Copyright © 2011-2022 走看看