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

推荐订阅源

WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
B
Blog
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Jina AI
Jina AI
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
L
LangChain Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Help Net Security
B
Blog RSS Feed
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题

博客园 - <林海>

JavaScript中Array 对象相关的几个方法 Javascript总结 sql时间格式转换问题 Transact SQL 常用语句以及函数 C#读取硬盘序列号 C#注册表操作类 Windows API函数大全 windows运行命令详解 Javascript String 对象增强 VS.NET 2003 命名规范 .NET Remoting 实现分布式数据库查询 ASP.NET细节 JS刷新页面问题 javascript 列出本地某个目录下所有的文件 JavaScript每隔一段时间重新加载一下这个JS文件 JavaScript高效地检查每个值是否有重复 Javascript 构造endwith方法 用javascript判断某文件是否存在于本地机器的某路径下 JavaScript语法——style.display 属性
高效取得图片数据GetImgByte,返回结果数组和像素一一对应
<林海> · 2011-03-08 · via 博客园 - <林海>

     // 性能最高,其数组和像素一一对应   
        public static byte[] GetImgByte(this Bitmap bmp)
        {
            BitmapData bitmapData = bmp.LockBits(new System.Drawing.Rectangle(new Point(0, 0), bmp.Size),
                ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            byte[] res = new byte[bitmapData.Stride * bitmapData.Height];

            IntPtr Ptr = bitmapData.Scan0;
            System.Runtime.InteropServices.Marshal.Copy(Ptr, res, 0, res.Length);

            bmp.UnlockBits(bitmapData);
            return res;
        }