I have loaded image im my app with type ImageSource
, and I want to share it, but I need to convert image to IRandomAccessStream
.
For e.g.:
ImageSource _myLoadedImage;
IRandomAccessStream ras;
//Some code when _myLoadedImage convert to IRandomAccessStream
RandomAccessStreamReference.CreateFromStream(ras);
How can I do that?
There's not really a way to get at the pixel buffer unless it's a WriteableBitmap. If you have the original image data stream/file (ie a png or jpeg) you can use the decoder to get at it and later convert that into an image source. I do something like this in my blogpost here: http://www.iter.dk/post/2012/10/08/Using-User-Provided-Images-for-Secondary-Tiles.aspx