• [转载]Converting a bitmap to a byte array


    出自 OceanChip http://www.cnblogs.com/Oceanchip/archive/2006/12/06/583758.html

    方法一:

    Code

    in most cases this works fine, because your bitmap doesn't have an alpha channel. But if it does, and you want to preserve it, then use Format32bppArgb in the fist line when locking the bitmap.
    I wish I could think of a way of doing this without locking the bitmap (ie, you could use GCHandle.Alloc() and then call Marshal.Copy() using the created handle, but the problem is I wouldnt know the size of the bitmap without locking it's bits and the Marshal.Copy() function needs to know the size).

    Code

    方法二:

    Code
  • 相关阅读:
    MyEclipse和Microsoft Visual Studio常用快捷键
    数据源与JNDI资源实现JSP数据库连接池实例
    Tomcat配置+JSP页面模板修改UTF-8
    jquery插件
    jsp地址栏传中文显示乱码解决方法
    Java Web Project自定义错误页面,log4j记录日志。
    [原创] Java JDBC连接数据库,反射创建实体类对象并赋值数据库行记录(支持存储过程)
    测试上传图片
    js获取日期:昨天今天和明天、后天
    Axure谷歌浏览器Chrome扩展程序下载及安装方法
  • 原文地址:https://www.cnblogs.com/mishy/p/1288185.html
Copyright © 2020-2023  润新知