2

I want to convert a WriteableBitmap to byte[] and there are tons of examples in Internet yet not a single one works, or has methods that are not current in my runtime which is Windows Phone 8.1 store project. Here is my WriteableBitmap object.

BitmapImage bmpImage = new BitmapImage(new Uri("ms-appx:///Assets/no_pic.png", UriKind.Absolute));
WriteableBitmap DefaultPhotoBmp = new WriteableBitmap(bmpImage.PixelWidth, bmpImage.PixelHeight);

When using

DefaultPhotoBmp.ToByteArray();

from WriteableBitmapEx library I dont think it turns the image inside into a byte array but the WriteableBitmap object into a byte array.. I need the image

All I want to do is convert the picture inside in byte array and send it via HTTP. How?

v.g.
  • 1,076
  • 5
  • 19
  • 38
  • http://stackoverflow.com/questions/29351545/converting-writeablebitmap-to-byte-array-windows-phone-8-1-silverlight – Jon Jul 30 '15 at 19:27
  • 1
    This does not work under Windows Phone 8.1 store app.. 'IBuffer' does not contain a definition for 'AsStream' and the best extension method overload 'WindowsRuntimeStreamExtensions.AsStream(IRandomAccessStream)' requires a receiver of type 'IRandomAccessStream' – v.g. Jul 31 '15 at 09:06
  • I think you tried the wrong example at that link, look at the accepted answer example. – Jon Jul 31 '15 at 16:28
  • 1
    Again this is a Windows Phone 8.1 runtime app. SaveJpeg() method of WriteableBitmap is not present.. – v.g. Aug 03 '15 at 07:00

0 Answers0