title: How can I get an image out of the clipboard without losing the alpha channel in .NET?
body: <p>I'm trying to save a copied image from the clipboard but it's losing its alpha channel:</p>
  
  <pre><code>Image clipboardImage = Clipboard.GetImage();
  string imagePath = Path.GetTempFileName();
  clipboardImage.Save(imagePath);
  </code></pre>
  
  <p>If I copy a 32bit image from PhotoShop or IE/Firefox/Chrome and run the above code, the output loses its alpha channel, instead it is saved against a black background.</p>
  
  <p>The image is saved as PNG, which can contain an alpha channel.</p>
  
  <p>The correct data appears to be in the clipboard because pasting into other applications (such as PhotoShop) retains the alpha channel.</p>
  
  <p>Can anyone put me out of my misery?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>// outputs FALSE
  Debug.WriteLine(Image.IsAlphaPixelFormat(Clipboard.GetImage().PixelFormat));
  </code></pre>
  
  <p>The above suggests that the alpha data is lost as soon as it's taken out of the clipboard. Perhaps I need to get it out of the clipboard some other way?</p>