question about converting SVG IM 6.9.10.17 Q16 Mac OXS Sierra

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25135
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

question about converting SVG IM 6.9.10.17 Q16 Mac OXS Sierra

Post by fmw42 » 2018-12-19T14:50:56-07:00

Examining the wizard.svg (http://www.fmwconcepts.com/misc_tests/wizard.svg) , it has the following properties

Geometry: 940x1250+0+0
Resolution: 37.8x37.8
Print size: 24.8677x33.0688
Units: PixelsPerCentimeter

If I do the multiplication, 37.8 * 33.0688 = 1250 px

But if I do

Code: Select all

convert -units PixelsPerCentimeter -density 37.8 wizard.svg wizard.png
The resulting size is only 370x492

Why is it not 940x1250?

The above was using Inkscape. So is this a bug in Inkscape or ImageMagick


I also get the same output size if using JPG and if using units of pixelsperinch. All 3 of these produce the same output dimensions though different densities.


convert -units PixelsPerCentimeter -density 37.8 MSVG:wizard.svg tmp1.png

convert -units PixelsPerInch -density 37.8 MSVG:wizard.svg tmp2.png

convert -units PixelsPerCentimeter -density 37.8 MSVG:wizard.svg tmp1.jpg

User avatar
fmw42
Posts: 25135
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: question about converting SVG IM 6.9.10.17 Q16 Mac OXS Sierra

Post by fmw42 » 2018-12-19T18:37:50-07:00

OK. I think I have this partially resolve. The issue is that identify -verbose using Inkscape shows:

Geometry: 940x1250+0+0
Resolution: 37.8x37.8
Print size: 24.8677x33.0688
Units: PixelsPerCentimeter


Whereas using MSVG shows:

Geometry: 940x1250+0+0
Units: Undefined

which lists no Resolution and Units undefined.

Convert as follows with MSVG, is consistent assuming density of 96 and units of pixelsperinch.

Code: Select all

convert -units PixelsPerInch -density 96 MSVG:wizard.svg tmp1.jpg
Produces an image of dimensions 940x12500.

Post Reply