Page 1 of 1
[SOLVED] Convert picture bytearray to image source
Posted: Thu Oct 15, 2015 5:19 am
by hamej
When i receive a picture serialized to a byte array, I used to do this to convert it to an image source:
BitmapImage bmi= new BitmapImage();
MemoryStream ms = new MemoryStream(PictureBytes);
bmi.SetSource(ms);
Image.Source = bmi;
Problem: SetSource is currently not supported for the Image class.
Until it will be supported: anybody have a work around?
hamej
Re: Convert picture bytearray to iameg source
Posted: Mon Nov 30, 2015 12:14 am
by rampatter
Try this
using (MemoryStream mStream = new MemoryStream(byteArrayIn))
{
return Image.FromStream(mStream);
}
Full Source :
ByteArray to ImagePatter
Re: Convert picture bytearray to image source
Posted: Fri Mar 11, 2016 2:38 am
by hamej
New problem: FromStream not supported for Image.
Re: Convert picture bytearray to iameg source
Posted: Tue May 17, 2016 10:31 am
by bmcguire
Hello.
Did you ever get a solution to this problem?
Thanks,
Bruce.
Re: Convert picture bytearray to iameg source
Posted: Tue May 17, 2016 11:13 pm
by hamej
So far no. But the c#/XAML folks have promises, that it will be solved in a beta later this year. For now I have used a work around by setting the image.source = direct path to the image file on the server like this:
http://localhost:62470/App_Data/Billeder/xxx.jpg
Re: Convert picture bytearray to iameg source
Posted: Sat Mar 04, 2017 7:57 pm
by JS-Support @Userware
Hi,
We are pleased to inform you that this feature has been implemented in Beta 10.10 and newer.
You can download it from:
http://forums.cshtml5.com/viewforum.php?f=6Please 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.
Thanks.
Regards,
JS-Support