I'm getting images from a url:
BitmapImage image = new BitmapImage(new Uri(article.ImageURL));
NLBI.Thumbnail.Source = image;
This works perfect, now i need to put it in a stream, to make it into byte array. I'm doing this:
WriteableBitmap wb = new WriteableBitmap(image);
MemoryStream ms = new MemoryStream();
wb.SaveJpeg(ms, image.PixelWidth, image.PixelHeight, 0, 100);
byte[] imageBytes = ms.ToArray();
And code fails with NullReference, how to fix it?
var webClient = new WebClient();
byte[] imageBytes = webClient.DownloadData(article.ImageURL);