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

Add a configuration directive for custom DPI to be used when converting SVG to PNG #674

Closed
znerol opened this issue Feb 24, 2016 · 5 comments

Comments

@znerol
Copy link
Contributor

znerol commented Feb 24, 2016

CairoSVG allows to specify the DPI value when converting SVG to PNG. Let's introduce a configuration directive in order to allow users to control this value.

@sbaechler
Copy link
Contributor

What is it supposed to do?

@znerol
Copy link
Contributor Author

znerol commented Feb 24, 2016

DPI = ratio between 1in and 1px, see help text of the cairosvg command line:

$ cairosvg --help
Usage: cairosvg filename [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -f FORMAT, --format=FORMAT
                        output format
  -d DPI, --dpi=DPI     ratio between 1in and 1px
  -o OUTPUT, --output=OUTPUT
                        output filename

@sbaechler
Copy link
Contributor

So would this only apply to SVGs that have their size unit set to 'in' or 'cm'?
Pretty much all SVGs that I came across had their size defined in pixels.

@znerol
Copy link
Contributor Author

znerol commented Feb 24, 2016

So would this only apply to SVGs that have their size unit set to 'in' or 'cm'?

Yes, indeed.

Pretty much all SVGs that I came across had their size defined in pixels.

Problem is that those which come in units other than pixels tend to look like crap if you render them with 96 DPI (which is the CairoSVG default).

@guilhermef
Copy link
Member

@znerol Can you make a PR ?

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

No branches or pull requests

3 participants