title: Uploading a Bitmap object to Azure blob storage
body: <p>I'm trying to download, resize and then upload an image to Azure blob storage.</p>
  
  <p>I can download the original image and resize it like so:</p>
  
  <pre><code>private bool DownloadandResizeImage(string originalLocation, string filename)
      {
          try
          {
              byte[] img;
              var request = (HttpWebRequest)WebRequest.Create(originalLocation);
  
              using (var response = request.GetResponse())
              using (var reader = new BinaryReader(response.GetResponseStream()))
              {
                  img = reader.ReadBytes(200000);
              }
  
              Image original;
  
              using (var ms = new MemoryStream(img))
              {
                  original = Image.FromStream(ms);
              }
  
              const int newHeight = 84;
              var newWidth = ScaleWidth(original.Height, 84, original.Width);
  
              using (var newPic = new Bitmap(newWidth, newHeight))
              using (var gr = Graphics.FromImage(newPic))
              {
                  gr.DrawImage(original, 0, 0, newWidth, newHeight);
                  // This is where I save the file, I would like to instead
                  // upload it to Azure
                  newPic.Save(filename, ImageFormat.Jpeg);
  
  
              }
  
              return true;
          }
          catch (Exception e)
          {
              return false;
          }
  
      }
  </code></pre>
  
  <p>I know I can use UploadFromFile to upload the saved file, but wondering if there is a way to do it directly from my object so I don't have to save it first?  I've tried upload from stream, and can do that after the using ms function, but then I resize the file</p>