This project has moved and is read-only. For the latest updates, please go here.

SVG to transparent PNG

Oct 15, 2015 at 7:53 AM
i'm trying to convert svg to transparent png.
        var url = "J:/MyGit/ImagePlayground/ImagePlayground/bin/Debug/mask.svg";
        var image = new MagickImage(url);
but the resulted image, has white background.
how do i keep the transparency of the result ?

Oct 15, 2015 at 12:02 PM
Can you post a link to your .svg file here?
Oct 16, 2015 at 8:55 PM
It is most likely that your svg contains a white 'fill' color. You can fix this by removing that fill color form the file with a text editor. You could also automate this.
Oct 23, 2015 at 8:28 AM
all of my converted svg files have white background where it should be transparent.
result :

here's what i do :
        var img = new MagickImage("J:/MyGit/ImagePlayground/ImagePlayground/bin/Debug/eagle.svg");
Oct 23, 2015 at 11:57 AM
You are getting a white background because that is the default background color. If you specify it before you read the image you can overrule the default. Below is an example:
using (var img = new MagickImage())
  img.BackgroundColor = MagickColor.Transparent;
Oct 24, 2015 at 8:27 AM
i had always pass the image path in magickimage constructor.
so that's why i always get white background.

thanks for your reply, it really helps.