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

推荐订阅源

宝玉的分享
宝玉的分享
博客园 - 【当耐特】
NISL@THU
NISL@THU
IT之家
IT之家
博客园 - 叶小钗
M
MIT News - Artificial intelligence
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
量子位
The Register - Security
The Register - Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
W
WeLiveSecurity
S
Security @ Cisco Blogs
Apple Machine Learning Research
Apple Machine Learning Research
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
Blog — PlanetScale
Blog — PlanetScale
美团技术团队
J
Java Code Geeks
P
Proofpoint News Feed
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Last Week in AI
Last Week in AI
腾讯CDC
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
SecWiki News
SecWiki News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog
S
Secure Thoughts
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
N
News | PayPal Newsroom
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
Google DeepMind News
Google DeepMind News
博客园 - 聂微东
V
Visual Studio Blog
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
O
OpenAI News
Webroot Blog
Webroot Blog
Hacker News: Ask HN
Hacker News: Ask HN

博客园 - 三聪

流操作 如何利用.Net内置类,解析未知复杂Json对象 制作等比环切缩缩图 让window.setTimeout等支持带参数方法 利用NewID()生成随机数 创建缩略图 winform给html提供接口 IE下记住文本框的光标位置 ie下取得iframe里面内容 短网址计算 树冲突 学习Objective-C: 入门教程 C#根据字节数截取字符串 asp.net本地和全局资料文件的读取方法 jquery实现点击空白的事件 Asp.net 利用Jquery Ajax传送和接收DataTable 用一个最简单方法解决asp.net页面刷新导致数据的重复提交 SOS"未将对象引用设置到对象的实例" .NET调PHP Web Service的典型例子
截图片
三聪 · 2011-03-16 · via 博客园 - 三聪

 public static Image CutImage(Image img, int width, int height)
        {
            Bitmap image 
= new Bitmap(img);int calheight = width * image.Height / image.Width;
            
int calwidth = height * image.Width / image.Height;

            Image img2;

if (calheight >= height)
            {
                img2 
= image.GetThumbnailImage(width, calheight, null, IntPtr.Zero);
            }
            
else
            {
                img2 
= image.GetThumbnailImage(calwidth, height, null, IntPtr.Zero);
            }

            Bitmap bitmap 

= new Bitmap(img2);
            
int x = (bitmap.Width - width) / 2;
            
int y = (bitmap.Height - height) / 2;
            Rectangle cloneRect 
= new Rectangle(x, y, width, height);
            PixelFormat format 
= bitmap.PixelFormat;
            Bitmap cloneBitmap 
= bitmap.Clone(cloneRect, format);return cloneBitmap;

        }