New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert transparent svg to png #184

Closed
plepe opened this Issue Aug 2, 2014 · 4 comments

Comments

2 participants
@plepe

plepe commented Aug 2, 2014

I'm trying to convert a SVG file with transparent background to PNG, but the outcome always has a white background. I'm using

with Image(filename="test.svg") as img:
    img.format = 'png'
    img.alpha_channel = True # useless, is True anyway
    img.background_color = Color('#0000') # useless, I can choose any color, result always has white background
    img.save(filename="test.png")

Please assist me.

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 2, 2014

It seems due to ImageMagick’s poor support of SVG. Although I heard that it can be solved if ImageMagick is forced to use Inkscape as its SVG delegate (see delegates.xml), but I’m not sure about that.

@dahlia dahlia added the bug label Aug 2, 2014

@plepe

This comment has been minimized.

plepe commented Aug 2, 2014

You can do it with the ImageMagick command line utility:

convert -background transparent file.svg file.png

It's important to supply -background transparent prior to opening the file. So I thought, maybe I can open the file in Wand using Image(filename="test.svg", background=None) (or something similar), but unfortunately the background parameter is only accepted when creating images.

@dahlia dahlia closed this in 950de77 Aug 2, 2014

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 2, 2014

The bug is fixed in 0.3.8, a just released latest version.

@plepe

This comment has been minimized.

plepe commented Aug 2, 2014

Confirmed. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment