[SOLVED] How to load image from MemoryStream?

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
bmcguire
Posts: 4
Joined: Wed May 11, 2016 10:23 am

[SOLVED] How to load image from MemoryStream?

Postby bmcguire » Tue May 17, 2016 12:31 pm

Hello.

Is there a work around for loading a BitmapImage from a MemoryStream, given that SetSource does not seem to be supported yet?

Thanks,

Bruce.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: How to load image from MemoryStream?

Postby JS-Support @Userware » Sat Mar 04, 2017 8:05 pm

Hi,

We are pleased to inform you that the SetSource feature, to load an image from MemoryStream, has been implemented in Beta 10.10 and newer.

Here is an example showing a WCF SOAP web service that returns an image as a byte array:

Code: Select all

void proxy_GetImageCompleted(object sender, GetImageCompletedEventArgs e)
{
    byte[] byteArray = e.Result.Image;
    using (MemoryStream stream = new MemoryStream(byteArray, 0, byteArray.Length))
    {
        BitmapImage b = new BitmapImage();
        b.SetSource(stream);
        imageControl.Source = b;
    }
}


Please note that, in case of large images, it is recommended to load the image from a URL instead of a byte array/stream instead, to ensure the best memory consumption and performance.


You can download the latest version of the product from:
http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 34 guests

 

 

cron