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