I have a transparent .png that I'm loading from my assembly. I'm converting this embedded resource to a byte array then to a Bitmap Image, problem is there's always a white dot added to the image,
I'm using the following code,
using (var stream = this.GetType().Assembly.GetManifestResourceStream("MyProject.test.png"))
{
var buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
return buffer;
}
This image is straight from https://www.iconfinder.com/ with no modification, I've also tried other images, same effect.
Set the Build Action of the image file to
Resource
instead ofEmbedded Resource
and then create a BitmapImage like this:If you had a file
test.png
in anImages
folder in your project, the Uri would look like this: