惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
IT之家
IT之家
V
V2EX
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
B
Blog
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网

博客园 - Ame

将项目改为windows 服务的步骤 js 设为首页,加入收藏夹 - Ame - 博客园 FCKeditor 的使用心得 IE,firefox 里对浏览器事件处理的兼容性处理 - Ame - 博客园 项目中的JS ,alert 出现乱码 Jquery 插件参考 报表实现的参考 RDLC 矩阵使用 - Ame - 博客园 ajaxpro 的使用心得 - Ame - 博客园 [转]ReportViewer 2008的部署 Reporting services 权限 经典正则表达式 [转载] iframe和跨站点cookie被阻止 (转载) js 动态生成HTML,并加载事件遇到的问题 - Ame - 博客园 jquery.cookies 的使用心得[仅做自己记忆所用] 一些药物的副作用 一些食物的用法 Blogs Flog Fat 蜂蜜知识大全 - Ame - 博客园
压缩图片 - Ame - 博客园
Ame · 2010-06-29 · via 博客园 - Ame

 public void CreateThumbnailImage() 

 { 

     string imgFile = "e:/test.jpg"; 

     System.Drawing.Image img = System.Drawing.Image.FromFile(imgFile); 

     System.Drawing.Image.GetThumbnailImageAbort cb = new System.Drawing.Image.GetThumbnailImageAbort(CallBack); 

     System.Drawing.Image thumbnailImage = img.GetThumbnailImage(120, 120, cb, System.IntPtr.Zero); 

     string extendName = imgFile.Substring(imgFile.LastIndexOf(".") + 1); 

     ImageFormat imgFormat = GetImageFormat(extendName); 

     thumbnailImage.Save("e:/result.jpg",imgFormat); 

 } 

 public bool CallBack() 

 { 

     return     false; 

 }

 //获得图片格式 

        private static ImageFormat GetImageFormat(String extendName)
        {
            extendName = extendName.ToLower();
            switch (extendName)
            {
                case "gif":
                    return ImageFormat.Gif;
                case "jpg":
                case "jpeg":
                    return ImageFormat.Jpeg;
                case "bmp":
                    return ImageFormat.Bmp;
                case "wmf":
                    return ImageFormat.Emf;
                case "exif":
                    return ImageFormat.Exif;
                case "icon":
                    return ImageFormat.Icon;
                case "tiff":
                    return ImageFormat.Tiff;
                default:
                    return ImageFormat.Png;
            }
        }