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

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
hairykid
Posts: 17
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

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

Post by hairykid » 2019-05-16T06:59:56-07:00

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

User avatar
magick
Site Admin
Posts: 10994
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2019-05-21T15:32:47-07:00

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?

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

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

Post by fmw42 » 2019-05-21T15:51:04-07:00

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.

User avatar
magick
Site Admin
Posts: 10994
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2019-05-21T18:16:29-07:00

@hairykid shows the filename as msvg:... which suggests the renderer is MSVG, the internal ImageMagick SVG renderer.

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

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

Post by fmw42 » 2019-05-21T19:21:21-07:00

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.

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

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

Post by fmw42 » 2019-05-21T19:31:27-07:00

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

hairykid
Posts: 17
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

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

Post by hairykid » 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

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

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

Post by fmw42 » 2019-05-24T08:17:35-07:00

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?

hairykid
Posts: 17
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

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

Post by hairykid » 2019-05-24T11:33:30-07:00

Yes inkscape is installed, is there any way to tell if IM is using it?

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

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

Post by fmw42 » 2019-05-24T11:56:25-07:00

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

hairykid
Posts: 17
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

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

Post by hairykid » 2019-05-28T23:39:21-07:00

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.

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

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

Post by fmw42 » 2019-05-29T10:59:42-07:00

remove the msvg: in front of your svg file. That forces IM to use its own internal MSVG/XML renderer and not Inkscape.

hairykid
Posts: 17
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

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

Post by hairykid » 2019-05-29T23:10:11-07:00

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.

Post Reply