Page 1 of 1

Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-16T06:59:56-07:00
by hairykid
OS: Ubuntu 18.10
Version: ImageMagick 6.9.10-42 Q16 x86_64
Issue also exists on - V 7.0.8-45

The command being run is -

Code: Select all

convert msvg:/var/www/mydomain.co.uk/sites/default/files/tmp/preview-526369564-x3Sup6 png:/var/www/mydomain.co.uk/sites/default/files/preview/1818709664-1558014451.png
To replicate issue -

The svg image used is here - https://ufile.io/4795n0ye

The converted png is here - https://ufile.io/x7poxki3

As can be seen, there is extra white-space around the ampersand.

Thanks for any help with this

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-21T15:32:47-07:00
by magick
We're not getting extra space in the ampersand with ImageMagick 7.0.8-46, the current release. Can you try with -46 and see if the problem persists for you?

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-21T15:51:04-07:00
by fmw42
I think the OP should report which SVG renderer is being use. Is it the Imagemagick MSVG/XML, RSVG delegate and what version, or Inkscape and what version. These are listed in order of increasing quality for the result. The OP can find out if the either of the first two by using

Code: Select all

convert -list format
and report what it shows for the line for SVG.

Inkscape will be used if installed on a version of Imagemagick at 6.7.9-0 or higher. Please also report your IM version and platform.

Information about what renderer may also be found by including -verbose in the command line.

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-21T18:16:29-07:00
by magick
@hairykid shows the filename as msvg:... which suggests the renderer is MSVG, the internal ImageMagick SVG renderer.

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-21T19:21:21-07:00
by fmw42
magick wrote: 2019-05-21T18:16:29-07:00 @hairykid shows the filename as msvg:... which suggests the renderer is MSVG, the internal ImageMagick SVG renderer.
OOPS! Sorry, I overlooked that.

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-21T19:31:27-07:00
by fmw42
I get two quite different renderings with MSVG vs Inkscape using IM 6.9.10.46 as well as 7.0.10.46 (apart from different default densities)

Code: Select all

convert MSVG:original.svg original2.png
Image

Code: Select all

convert original.svg orig_ink2.png
Image

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-24T03:00:45-07:00
by hairykid
Unfortunately upgrading to Version: ImageMagick 7.0.8-46 didn't fix it for me.

Does this mean it is not an ImageMagick issue?

Thanks

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-24T08:17:35-07:00
by fmw42
hairykid wrote: 2019-05-24T03:00:45-07:00 Unfortunately upgrading to Version: ImageMagick 7.0.8-46 didn't fix it for me.

Does this mean it is not an ImageMagick issue?

Thanks
Did you install inkscape on your system?

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-24T11:33:30-07:00
by hairykid
Yes inkscape is installed, is there any way to tell if IM is using it?

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-24T11:56:25-07:00
by fmw42
Add -verbose to the command line

Code: Select all

convert -verbose original.svg original.png
'inkscape' '/tmp/magick-1497OpBiiWuF7lzl' --export-png='/tmp/magick-1497tC_REUWAA9e2' --export-dpi='96,96' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/tmp/magick-14977VaBNUCEconz' 2>&1
/tmp/magick-1497tC_REUWAA9e2 PNG 694x662 694x662+0+0 8-bit sRGB 29321B 0.010u 0:00.013
original.svg SVG 694x662 694x662+0+0 8-bit sRGB 29321B 0.000u 0:00.000
original.svg=>original.png SVG 694x662 694x662+0+0 8-bit sRGB 256c 14385B 0.150u 0:00.048

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-28T23:39:21-07:00
by hairykid
Ok so with that command it is using inkscape, however it is not using it when I use

convert -verbose +antialias msvg:home.svg png:converted

Which I guess from reading up on this is quite to be expected. My issue is that this is not a simple case of me using command line but this is a application which is a few years old, and I'm unsure whether changing it to not use msvg would even be viable.

But thanks for all your help, I will report back with my findings and see where we want to take this.

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-29T10:59:42-07:00
by fmw42
remove the msvg: in front of your svg file. That forces IM to use its own internal MSVG/XML renderer and not Inkscape.

Re: Conversion of SVG image to PNG with text that includes an & adds extra space around ampersand

Posted: 2019-05-29T23:10:11-07:00
by hairykid
As I said, this is not a simple case of me using command line but this is a application which is a few years old, and I'm unsure whether changing it to not use msvg would even be viable.