public static byte[] Bitmap2Byte(Bitmap bitmap)
{
using (MemoryStream stream = new MemoryStream())
{
bitmap.Save(stream , ImageFormat.Jpeg);
byte[] data = new byte[stream.Length];
stream.Seek( , SeekOrigin.Begin);
stream.Read(data , , Convert.ToInt32(stream.Length));
return data;
}
}

c# 靠谱的bitmap转byte[]的更多相关文章

  1. Android-Drawable、Bitmap、byte[]、资源文件相互转换

    我们在Android的开发中,经常可以遇到图片的处理,当中,有很多是 Bitmap.Drawable.byte[]和资源文件它们直接相互转换. 今天就此总结一下: 1.资源文件转为Drawable 2 ...

  2. Android Drawable、Bitmap、byte[]之间的转换

    转自http://blog.csdn.net/june5253/article/details/7826597 1.Bitmap-->Drawable Bitmap drawable2Bitma ...

  3. Android中Bitmap, Drawable, Byte,ID之间的转化

    Android中Bitmap, Drawable, Byte,ID之间的转化 1.  Bitmap 转化为 byte ByteArrayOutputStream out = new ByteArray ...

  4. Drawable、Bitmap、byte[]之间的转换

    android在处理一写图片资源的时候,会进行一些类型的转换: 1 Drawable → Bitmap 的简单方法 ((BitmapDrawable)res.getDrawable(R.drawabl ...

  5. WPF中的Bitmap与byte

    原文:WPF中的Bitmap与byte public MainWindow() { InitializeComponent(); byte[] b = GetPictureData(@"F: ...

  6. Android Bitmap Drawable byte[] InputStream 相互转换方法

    用android处理图片的时候,由于得到的资源不一样,所以经常要在各种格式中相互转化,以下介绍了 Bitmap Drawable byte[] InputStream 之间的转换方法: import ...

  7. android开发之Bitmap 、byte[] 、 Drawable之间的相互转换

    一.相关概念 1.Drawable就是一个可画的对象,其可能是一张位图(BitmapDrawable),也可能是一个图形(ShapeDrawable),还有可能是一个图层(LayerDrawable) ...

  8. Bitmap和byte[]的相互转换

    /// <summary> /// 将Bitmap转换为字节数组 /// </summary> /// <param name="width"> ...

  9. Android中Bitmap, Drawable, Byte之间的转化

    1.  Bitmap 转化为 byte ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap. ...

随机推荐

  1. .NET 自带的动态代理+Expression 实现AOP

    下面代码(摘抄之别处,原创在哪不知)是采用TransparentProxy和RealProxy实现对象的动态代理.碍于其使用反射掉用方法,所以就小试着将反射改成Expression以提高执行的效率.第 ...

  2. Lingo 做线性规划 - Game Thoery

    Reference: <An Introduction to Management Science Quantitative Approaches to Decision Making, Rev ...

  3. get请求的最大字符长度

    各浏览器HTTP Get请求URL最大长度并不相同,几类常用浏览器最大长度及超过最大长度后提交情况如下: IE6.0                :url最大长度2083个字符,超过最大长度后无法提 ...

  4. python decorator simple example

    Why we need the decorator in python ? Let's see a example: #!/usr/bin/python def fun_1(x): return x* ...

  5. atitit.导航的实现最佳实践and声明式编程

    atitit.导航的实现最佳实践and声明式编程 1. 顶部水平栏导航 1 2. 竖直/侧边栏导航 1 3. 选项卡导航 1 4. 面包屑导航 1 5. 标签导航 1 6. 搜索导航 2 7. 分面/ ...

  6. paip.简化字-手写参考二简字..共98个

    paip.简化字-手写参考二简字..共98个 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/a ...

  7. Maven学习总结(九)——使用Nexus搭建Maven私服

    一.搭建nexus私服的目的 为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,所以很有必要在局域网里找一台有外网权限的机器,搭建n ...

  8. Linux下远程桌面Windows

    rdesktop-1.7.0.tar.gz [root@localhost fcitx]# tar rdesktop-1.7.0.tar.gz [root@localhost fcitx]#cd rd ...

  9. HOWTO - Basic MSI安装包在安装运行过程中如何获取完整源路径

    有朋友问到如何在一个Windows Installer安装包中获取安装包源路径,就是在安装包运行过程中动态获取*.msi所在完整路径. 这个问题分两类,如果我们的安装包只是一个*.msi安装文件,那么 ...

  10. object-c学习1

    因为公司需要,开始看object-c,虽然还没ios系统,但现学下语法. 第一个例子不应该是helloWorld吗?但<Learn Objective-C on the Mac>书上不是. ...