1
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

Robaticus
  • 22,857
  • 5
  • 54
  • 63
albatross
  • 455
  • 2
  • 8
  • 27

1 Answers1

5

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();
coder
  • 13,002
  • 31
  • 112
  • 214