Page 1 of 1

ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-21T01:50:27-07:00
by yoones
Hi,

I'm trying to understand why, for the same SVG file, I find two different sizes depending on the operating system/imagemagick version I use.

File: https://github.com/rails/rails/blob/mas ... s/icon.svg

With Debian 9.8/ImageMagick 6:

Code: Select all

Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

Code: Select all

./test/fixtures/files/icon.svg SVG 743x548 743x548+0+0 8-bit sRGB 9.44KB 0.000u 0:00.000
With Ubuntu/ImageMagick 7:

Code: Select all

Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-10-25 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jp2 jpeg lcms ltdl lzma png tiff webp xml zlib

Code: Select all

./test/fixtures/files/icon.svg SVG 792x584 792x584+0+0 16-bit sRGB 1573B 0.000u 0:00.009
How come I find two different sizes? Is it related to ImageMagick or to something else?

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-21T04:53:18-07:00
by snibgo
From the SVG file, the correct size is 792x584 pixels.

I don't know why your v6 gives the wrong size. What command did you use? What delegate rasterized the SVG (MVG, or RSVG, or Inkscape)?

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-21T06:12:14-07:00
by yoones
snibgo wrote: 2019-04-21T04:53:18-07:00 From the SVG file, the correct size is 792x584 pixels.

I don't know why your v6 gives the wrong size. What command did you use? What delegate rasterized the SVG (MVG, or RSVG, or Inkscape)?
1/ Command: `identify ./test/fixtures/files/icon.svg`

2/ I don't know how it got rasterized (it's a file I found in the source code of the Ruby on Rails project).

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-21T12:52:53-07:00
by fmw42
IM can use different delegates for rasterizing SVG files. Which one did you use? If you have Inkscape on your system, ImageMagick will use that. Otherwise it might be the RSVG delegate or Imagemagick's own MSVG/XML delegate. Run

Code: Select all

convert -list format
look at the end of the line for SVG. What does it say? RSVG or XML?

I get 792 × 584 when using Inkscape on ImageMagick 6.9.10.40 and 7.0.8.40

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-22T01:00:55-07:00
by yoones
fmw42 wrote: 2019-04-21T12:52:53-07:00 IM can use different delegates for rasterizing SVG files. Which one did you use? If you have Inkscape on your system, ImageMagick will use that. Otherwise it might be the RSVG delegate or Imagemagick's own MSVG/XML delegate. Run

Code: Select all

convert -list format
look at the end of the line for SVG. What does it say? RSVG or XML?

I get 792 × 584 when using Inkscape on ImageMagick 6.9.10.40 and 7.0.8.40
It's XML.

`SVG SVG rw+ Scalable Vector Graphics (XML 2.9.4)`

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-22T10:06:28-07:00
by fmw42
I get the same 792 × 584 when using both Inkscape and MSVG/XML with IM 6.9.10.41 and IM 7.0.8.41.

I recommend that you upgrade and install Inkscape, since it is a better SVG renderer than MSVG/XML

Re: ImageMagick 6 and 7 give different SVG size

Posted: 2019-04-23T01:30:49-07:00
by yoones
Upgrading to IM 7 fixed the problem. Thank you for the help!