dorjeduck
dorjeduck

Reputation: 7794

inkscape command line svg to png - set both width and dpi

I want to convert a svg to a png with the inkscape command line tool. Despite of what is specified in the svg i want to set both the width of the resulting png and the dpi to be used. From the inkscape docu it seems this is not possible:

-w WIDTH, --export-width=WIDTH

The width of generated bitmap in pixels. This value overrides the --export-dpi setting (or the DPI hint if used with --export-use-hints).

I can't really understand how this could be as the width and the dpi used should not be directly related. How can I achieve to set both values.

Thanks, Martin

Upvotes: 8

Views: 9146

Answers (1)

dorjeduck
dorjeduck

Reputation: 7794

Ok got it I think, here as it goes in my concrete example:

In the svg the width is 2480 pixel (what you need for DinA4 300 dpi print). Now my mistake was to add "-d 300" to the inkscape call which doesn't make sense if the svg does not give the width in some unit. When doing so the resultant image has a width of 2480 * 300 / 90 = 8267 pixel . So if working with pixel in the svg you need to be aware of the fact the inkscape interprets this as 90 dpi ...

Well i guess only my confusion here yet happy to share ;-)

Upvotes: 4

Related Questions