转换图像字节数组,在Windows Phone 7不System.Drawing中的Dll任何其他方式? [英] Convert image to byte array on Windows Phone 7 No System.Drawing Dll any other way?

查看:145
本文介绍了转换图像字节数组,在Windows Phone 7不System.Drawing中的Dll任何其他方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Byte[] result = (Byte[])new ImageConverter().ConvertTo(img1, typeof(Byte[]));

//I cant use Image Converter add Image Class ? Drawing dll 

MemoryStream ms = new MemoryStream();

img1.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);

return ms.ToArray();

//Cannot see System.Drawing dll and there is no  sth like Drawing.Imaging... 

是否有任何其他选项,而不是从出源(我的意思是我会复制它,然后将其添加为外部DLL)加入的dll?我的项目是在Windows 7手机应用程序,并不能看到这样的Drwaing.dll STJ

Is there any other option rather than adding dll from the out source(I mean I ll copy it and then add it as an external dll )? My project is in windows 7 phone application and can not see Drwaing.dll stj like that

感谢

推荐答案

首先是没有的 System.Drawing中 WP7

您可以做这样的事情:

MemoryStream ms = new MemoryStream();
WriteableBitmap wb = new WriteableBitmap(myimage);
wb.SaveJpeg(ms, myimage.PixelWidth, myimage.PixelHeight, 0, 100);
byte [] imageBytes = ms.ToArray();

这篇关于转换图像字节数组,在Windows Phone 7不System.Drawing中的Dll任何其他方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆