I've been having trouble pasting an image from my application into PowerPoint, while preserving transparency. I have an image stored as a System.Drawing.Graphics
type which I then convert to a System.Drawing.Bitmap
type and copy to the clipboard. During this process I also use Bitmap.MakeTransparent(Color.Black)
so that everything in the original document which was black will be transparent when the image is pasted.
if (GraphicsInterface.getGraphics() != null)
{
Image image = GraphicsInterface.getGraphics();
Bitmap bitmap = new Bitmap(image);
bitmap.MakeTransparent(Color.Black);
Clipboard.SetImage(bitmap);
}
However, when I try to paste the image into an application like PowerPoint, instead of being transparent, everything that was black is now a very light gray.
Is my approach correct? Is there a way to reconcile the transparent values in .net and PowerPoint? Or will the transparency have to be done manually once the image is inserted to PowerPoint?