piqnt / svgexport

SVG to PNG/JPEG command-line tool and Node.js module
927 stars 85 forks source link

Specify background color with jpg export #10

Closed Frozenfire92 closed 9 years ago

Frozenfire92 commented 9 years ago

By default I seem to be getting black and can't find a way to change this from within the svg

shakiba commented 9 years ago

Yes, it seems phantomjs set the default background to black and I don't remember any way to set svg background. I guess we should add a new param to svgexport to set page background or even better an option to inject css styles.

Sjors commented 9 years ago

It would indeed be nice if I can change the background color. In particular for PNG exports I'd like to make the background transparent.

shakiba commented 9 years ago

@Frozenfire92 @Sjors Just published a new update which you can pass styles to be injected into SVG document, for example:

svgexport input.svg output.jpg "svg { background: silver; }"

I'm not sure how robust this solution is, please try it and let me know if there is any issue.