user937036
user937036

Reputation: 391

Scale SVG Proportionatly to PNG

I need to scale some svg's proportionately and output to a PNG max size 32px (either dimension).

Right now I'm using Inkscape but the proportions get warped depending on the image.

"C:\Program Files\Inkscape\inkscape.exe" "yo.svg" --export-png="yo.png" --export-area-drawing -w32 -h32

Upvotes: 1

Views: 150

Answers (1)

John Sharp
John Sharp

Reputation: 811

I don't really know Windows batch scripts, but the command

inkscape yo.svg --query-width
inkskape yo.svg --query-height

will give you the width and height of your drawing. Can you use an if statement to see which one is bigger and scale only the appropriate dimension?

So if the width was greater than the height, doing:

inkscape yo.svg --export-png="yo.png" --export-area-drawing -w32

would achieve what you want.

Upvotes: 1

Related Questions