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);
  • 相关阅读:
    0401. Binary Watch (E)
    0436. Find Right Interval (M)
    0151. Reverse Words in a String (M)
    1344. Angle Between Hands of a Clock (M)
    0435. Non-overlapping Intervals (M)
    0434. Number of Segments in a String (E)
    0063. Unique Paths II (M)
    0062. Unique Paths (M)
    0100. Same Tree (E)
    0190. Reverse Bits (E)
  • 原文地址:https://www.cnblogs.com/gateluck/p/2105267.html
Copyright © 2011-2022 走看看