Page 1 of 1

Scale SVG files to png with specific stroke width and image

Posted: 2010-08-07T10:02:16-07:00
by inzaghi89
Hello,

I want to scale svg files on my pc to png. But there is some kind of problem. I want to set stroke with to 1px, so I use this command:

Code: Select all

mogrify -density 400 -strokewidth 1 -format png mysvgfile*.svg
Svg file names is mysvgfile1.svg, mysvgfile2.svg...

But finally it doesn't work properly. Of course, my svg file has been saved as png. Also there is a problem with width. I want to set 400px of width, but file is... much bigger... same problem is with stroke.

The stroke should have 1px width.

Edit:
It might be in two steps:
1. scaling svg files to another svg with 400px width and 1px stroke.
2. convert svg files to png

Re: Scale SVG files to png with specific stroke width and im

Posted: 2010-08-08T19:52:59-07:00
by anthony
The SVG image itself is probably overriding the stroke width setting!

IM has two SVG conversion methods see SVG Input Drivers: RSVG vs MSVG
http://www.imagemagick.org/Usage/draw/#svg_drivers

If you have a RSVG version the converts is external to IM so stroke width is not seen

If it is using MSVG (internal) the stroke width is probably being overridden.


The only solution is to either... modify the SVG file to use strokewidth 1px
OR use a higher resolution and shrink (resize) the image.
However that last will also fail is the stroke is being defined inside the SVG using real-world units rather than pixels