title: SharpDx Save Bitmap to File
body: <p>I have a Sharpdx Direct2D1 Bitmap from the render target. I want to save it to a file as an image though. This is for test purposes. I am not sure if i need a WIC bitmap for that or how to convert these bitmaps. Or how to receive the WIC bitmap in the first place.</p>
  
  <p>Also i can't find an easy explanation how to save this bitmap to a file in general.</p>
  
  <p>Any help appriciated.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I'm using this approach now: <a href="http://www.rolandk.de/wp/2013/06/inhalt-der-rendertarget-textur-in-ein-bitmap-kopieren/" rel="nofollow noreferrer">http://www.rolandk.de/wp/2013/06/inhalt-der-rendertarget-textur-in-ein-bitmap-kopieren/</a></p>
  
  <p>It is in German, but what he says is, that you have to copy the resource of the
  render target to a staging resource to have access via the cpu. Then copy the contents over to a bitmap.</p>
  
  <p>I'm trying this approach then finally using bitmap.Save(filename). But somehow the bitmap stays empty. Maybe i miss to encode the file correctly. But seems more like I don't get the data from the back buffer target at all.</p>