Skip to content
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

setting background color for an svg #360

Closed
eyaler opened this issue Jan 10, 2018 · 1 comment
Closed

setting background color for an svg #360

eyaler opened this issue Jan 10, 2018 · 1 comment

Comments

@eyaler
Copy link

eyaler commented Jan 10, 2018

i am trying to set the background color to white when loading an svg, however Image() ignores it

@emcconville
Copy link
Owner

Vector graphics are a little different as the size & background color may need to be defined before reading the file.

from wand.image import Image
from wand.color import Color
from wand.api import library

with Image() as img:
    library.MagickSetSize(img.wand, 500, 500)
    with Color('WHITE') as bg:
        library.MagickSetBackgroundColor(img.wand, bg.resource)
    img.read(filename='the_image_file.svg')

Which should be the same as...

convert -size 500x500 -background WHITE the_image_file.svg ...

I think there's a few FIXME, or TODO notes in wand.image.Image.__init__() method to improve handling of this.

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

No branches or pull requests

2 participants