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
由于
答案 0 :(得分:5)
首先,WP7
中没有 system.drawing 。
您可以这样做:
MemoryStream ms = new MemoryStream();
WriteableBitmap wb = new WriteableBitmap(myimage);
wb.SaveJpeg(ms, myimage.PixelWidth, myimage.PixelHeight, 0, 100);
byte [] imageBytes = ms.ToArray();