Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Image stream to string converter

$
0
0

Hello, I need an image stream to string converter and backwards. For the image stream to string converter, I did it like this:
byte[] bytearray = StreamToBytesConverter.ReadToEnd(stream);
string mystring = BitConverter.ToString(bytearray);
(I used this StreamToBytesConverter: https://stackoverflow.com/a/1080445/13019994

After that I need to Convert this string back to a stream:
byte[] newbytearray = Encoding.ASCII.GetBytes(mystring);
Stream convertedstream = new MemoryStream(newbytearray);

If I set this stream into a button like this: mybutton.ImageSource = ImageSource.FromStream(() => convertedstream); nothing happens.
Can anybody help me? Thanks in advance


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>