ImageMagick 6 and 7 give different SVG size

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
yoones
Posts: 4
Joined: 2019-04-21T00:35:33-07:00
Authentication code: 1152

ImageMagick 6 and 7 give different SVG size

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick 6 and 7 give different SVG size

Post 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)?
snibgo's IM pages: im.snibgo.com
yoones
Posts: 4
Joined: 2019-04-21T00:35:33-07:00
Authentication code: 1152

Re: ImageMagick 6 and 7 give different SVG size

Post 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).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick 6 and 7 give different SVG size

Post 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
yoones
Posts: 4
Joined: 2019-04-21T00:35:33-07:00
Authentication code: 1152

Re: ImageMagick 6 and 7 give different SVG size

Post 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)`
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick 6 and 7 give different SVG size

Post 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
yoones
Posts: 4
Joined: 2019-04-21T00:35:33-07:00
Authentication code: 1152

Re: ImageMagick 6 and 7 give different SVG size

Post by yoones »

Upgrading to IM 7 fixed the problem. Thank you for the help!
Post Reply