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. 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* ...

  2. paip.陕北方言 广东方言的不同单字 1千高频字

    paip.陕北方言 广东方言的不同单字 1千高频字  SELECT * FROM `canx` c where c.cn in (  select zi from hezi1k h)  and st ...

  3. 使用socket.io开发简单群聊功能

    1.新建package.json文件: { "name": "socket-chat-example", "version": " ...

  4. Autoprefixer处理CSS3属性前缀

    http://www.w3cplus.com/css3/autoprefixer-css-vender-prefixes.html

  5. 转:MPlayer源代码分析

    一.Mplayer支持的格式 MPlayer是一个LINUX下的视频播放器,它支持相当多的媒体格式,无论在音频播放还是在视频播放方面,可以说它支持的格式是相当全面的. 视频格式支持:MPEG.AVI. ...

  6. jquery判断checkbox是否选中及改变checkbox状态(转)

    jquery判断checked的三种方法:.attr('checked):   //看版本1.6+返回:”checked”或”undefined” ;1.5-返回:true或false.prop('c ...

  7. C#根据日期范围过滤IQueryable<T>集合

    需要扩展IQueryable<T>,参数包括一个DateTime类型的属性.开始日期.截止日期. public static class MyExtension { public stat ...

  8. Moccakids-Tangram Puzzle 限免啦!

    圣诞前上线的App,Tangram Puzzle 限免,大家去下载玩玩. 介绍网站:http://www.mokamisu.com/ App Store:https://itunes.apple.co ...

  9. ImageEdit 加载图片

    从本地加载图片 <dxe:ImageEdit Name="iePortrait" Height="120" Width="100" S ...

  10. nlog(n)解动态规划--最长上升子序列(Longest increasing subsequence)

    最长上升子序列LIS问题属于动态规划的初级问题,用纯动态规划的方法来求解的时间复杂度是O(n^2).但是如果加上二叉搜索的方法,那么时间复杂度可以降到nlog(n).  具体分析参考:http://b ...