title: Writing Bitmap to OpenXML ImagePart via MemoryStream
body: <p>I have an image stored in a Bitmap object that I'd like to stick into an OpenXML document.  I've tried using a MemoryStream as an intermediate step as follows:</p>
  
  <pre><code>ImagePart part = container.AddNewPart&lt;ImagePart&gt;("image/jpeg", imageId);
  using (MemoryStream ms = new MemoryStream())
  {
      bitmap.Save(ms, ImageFormat.Jpeg);
      part.FeedData(ms);
  }
  </code></pre>
  
  <p>but that always results in empty files in the media folder and PowerPoint displaying an error instead of the images.  I know that the MemoryStream has the image data correctly as I've written it out to a file without issue.  When I try to load an image from a FileStream it works just fine.</p>
  
  <p>How can I get this Bitmap into an OpenXML document?</p>