Problem with radial gradient

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
quasar
Posts: 3
Joined: 2011-07-26T02:12:04-07:00
Authentication code: 8675308

Problem with radial gradient

Post by quasar »

Hello,

I need to convert an image SVG to PNG or JPG. It works fine with ImageMagick except for radial gradients. The source image is here: http://digita1.free.fr/opera_bug/im/source.svg

Under linux, I am using "ImageMagick 6.3.7 11/16/10 Q16", I do:

Code: Select all

convert -verbose source.svg test-linux.png
and here the result: http://digita1.free.fr/opera_bug/im/test-linux.png
The green radial gradient is not rendered, despite the fact that it looks like the gray radial gradient. The purple/blue radial gradient is more complex and is not rendered correctly. For this one is not a really problem for me, but the green one yes.

Under Windows, I am using "ImageMagick 6.7.1 Q16", I do the same thing and the result: http://digita1.free.fr/opera_bug/im/test-win.png
The result is totally screwed up... But it's not a problem for me, the production environnement is under linux.

So, what is the solution for the green radial gradient ? Do I need to change something in the SVG ?

Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem with radial gradient

Post by anthony »

Imagemagick has two methods of handling SVG vector image.

MSVG is an internal 'fallback' that works but has limitations, like radial gradients.
RSVG uses the rsvg external library (installed separtally).

You need to install the rsvg library (a complete SVG to raster converter) to get radial gradients.

For more information see, ImageMagick draw, and SVG
http://www.imagemagick.org/Usage/draw/#svg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
quasar
Posts: 3
Joined: 2011-07-26T02:12:04-07:00
Authentication code: 8675308

Re: Problem with radial gradient

Post by quasar »

Thanks for your reply, I have just tested with rsvg on linux:

Code: Select all

$ rsvg-convert --version
rsvg-convert version 2.34.0
$ rsvg-convert -o test-linux-rsvg.png -f png source.svg
here the result: http://digita1.free.fr/opera_bug/im/test-linux-rsvg.png :(

This time I have tested with inkscape on Windows in command line:

Code: Select all

C:\programmes\multimedia\Inkscape>inkscape c:\\source.svg --export-png=c:\\test-inkscape-win.png
Background RRGGBBAA: ffffff00
Area 0:0:2800:900 exported to 2800 x 900 pixels (90 dpi)
Bitmap saved as: c:\\test-inkscape-win.png

C:\programmes\multimedia\Inkscape>inkscape --version
Inkscape 0.48.1  (Feb 23 2011)
the result is perfect: http://digita1.free.fr/opera_bug/im/tes ... pe-win.png

It looks like Inkscape doesn't use rsvg. I think ITs won't be agree to install Inkscape on servers due to GTK dependency (and it seems stupid to install a huge software just for that).

I will try to find a solution to that.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem with radial gradient

Post by anthony »

It seems that you have found a bug in the RSVG library, as I get the same result either via RSGV or convert using RSVG delegate (no surprise) I suggest you report it to the RSVG team.

I can tell you that firefox displayed the SVG correct (at least I think it is correct).
That is one hell of a very complex gradient in the blue/purple circle!

Perhaps you can see if your can get the SVG test suit from W3 consortium for testing. They are the ones that defined that vector file format.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
quasar
Posts: 3
Joined: 2011-07-26T02:12:04-07:00
Authentication code: 8675308

Re: Problem with radial gradient

Post by quasar »

Okay, I have reported the bug: https://bugzilla.gnome.org/show_bug.cgi?id=655483 I will see for the W3 consortium but I think this the correct format.

Yes, in firefox and chrome it's correct, the SVG image (and gradients) is created with a web-app editor (svg-edit).
Post Reply