Search code examples
c#wpfcanvaspngtransparent

How do I draw a transparent PNG in WPF on a canvas using C#


This doesn't seem to be answered. I have a png ("Blue Arrow.png") which has a white background. I want to draw it on a canvas at location X,Y with rotation R with the white background being transparent.

Can somebody please point me in the right direction? The Googles they're not turning up anything.


Solution

  • There is no direct way in WPF to remove the background of a PNG and make it transparent. It would be much easier to start with a PNG that has a transparent background.

    Even if you find an external library that will do color keying/replacement, the quality won't be as good as starting with a proper PNG.