[Pkg-gmagick-im-team] Bug#771047: imagemagick: loads square SVG with a non-square aspect ratio

Simon McVittie smcv at debian.org
Wed Nov 26 11:08:42 UTC 2014


Control: retitle 771047 imagemagick: size/aspect ratio of blank SVG are lost by conversion via EPS

On Wed, 26 Nov 2014 at 10:30:16 +0000, Simon McVittie wrote:
> If I create this trivial SVG (from ikiwiki's regression tests)
> 
>     <svg width="30" height="30"/>
> 
> then imagemagick has very strange ideas about its size:
> 
> % identify square.svg
> square.svg=>/tmp/magick-19348iyfzJCMX4oRz PNG 612x792 612x792+0+0 16-bit sRGB 6.1KB 0.010u 0:00.000

"convert -debug all square.svg square.png" indicates that ImageMagick is
converting it from SVG to EPS with inkscape, then from EPS to PNG.

Because there are no graphical elements (lines, boxes, etc.) in the SVG,
the EPS comes out with a weird bounding box:

    %%BoundingBox: 0 -2147483648 0 -2147483648
    ...
    %%PageBoundingBox: 0 -2147483648 0 -2147483648
    ...
    q 0 -2147483648 0 0 rectclip q

which ImageMagick apparently interprets as 8.5x11 inches, presumably
some hard-coded default size; 612x792 px is 8.5x11 inches * 72 dpi.

Perhaps this is really an inkscape bug: the EPS export does not
preserve the size of the bounding box (but the same inkscape version
exporting a PNG is fine).

To work around this for ikiwiki's regression tests, I used a slightly
less trivial SVG:

    <svg width="30" height="30">
      <rect x="0" y="0" width="30" height="30" fill="blue"/>
    </svg>

Regards,
    S



More information about the Pkg-gmagick-im-team mailing list