SVG to PNG convertion problem

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
abp

SVG to PNG convertion problem

Post by abp »

I'm having problems with the <linearGradient> SVG tag. The below source gives unexpected output.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="13px" height="13px" viewBox="0 0 13 13" enable-background="new 0 0 13 13" xml:space="preserve">
<path fill="#FFFFFF" d="M6.5,12.3955078c-3.2514648,0-5.8955078-2.6445313-5.8955078-5.8955078
	c0-3.2514648,2.644043-5.8955078,5.8955078-5.8955078c3.25,0,5.8955078,2.644043,5.8955078,5.8955078
	C12.3955078,9.7509766,9.75,12.3955078,6.5,12.3955078L6.5,12.3955078z"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="3.043457" y1="3.043457" x2="9.9570827" y2="9.9570827">
	<stop  offset="0" style="stop-color:#88BB09"/>
	<stop  offset="1" style="stop-color:#5B8424"/>
</linearGradient>
<circle fill="url(#SVGID_1_)" cx="6.5004883" cy="6.5" r="4.8891602"/>
</svg>
Expect something similar to:
Image

With ImageMagick-6.4.9-4-Q16 I get:
Image

Any ideas as to how to solve this?

thanks in advance
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: SVG to PNG convertion problem

Post by magick »

Gradient support is not complete in ImageMagick. Are you running under Linux? If so, download / install the very latest ImageMagick release, 6.4.9-4 and it should fix the problem. If you are running under Windows, it will not render properly.
abp

Re: SVG to PNG convertion problem

Post by abp »

Sadly I run windows. Will use an embedded image until the gradient feature is ready.

Any idea when the gradient support will be done?

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

Re: SVG to PNG convertion problem

Post by magick »

We do not currently have an ETA on enhanced gradient support within ImageMagick.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG to PNG convertion problem

Post by anthony »

That SVG file also seems to behave differently with RSVG than with MSVG
and I do not mean shape or gradient.

The RSVG output has a weird extra circle of dots around the green circle, which does not exist in the internal MSVG handling.

Compare...
convert -density 500 source.svg show:
with
convert -density 500 MSVG:source.svg show:

on an IM with RSVG compile-time support.

The line is at the interface between the gradient and the background which you can see when you apply

convert -background red -density 500 t show:

I do not see this effect with the command "rsvg-view" so it must be cause by how IM is overlaying the RSVG output on to the background.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply