问题
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...
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
Thanks
回答1:
First there is no system.drawing in WP7
.
You can do something like this:
MemoryStream ms = new MemoryStream();
WriteableBitmap wb = new WriteableBitmap(myimage);
wb.SaveJpeg(ms, myimage.PixelWidth, myimage.PixelHeight, 0, 100);
byte [] imageBytes = ms.ToArray();
来源:https://stackoverflow.com/questions/10385642/convert-image-to-byte-array-on-windows-phone-7-no-system-drawing-dll-any-other-w