SVG, diagonal gradients not working

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
penciledin

SVG, diagonal gradients not working

Post by penciledin »

I've been working on converting svg's into several other formats using ImageMagick and so far, gradients have been pretty pig-headed.

Here's the SVG I created, with a diagonal gradient.

And here's the converted png, somehow with a vertical gradient:
Image

Code: Select all

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="150px" height="150px" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<defs>
<linearGradient id="awesome" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:rgb(255,255,0);
stop-opacity:1"/>
<stop offset="100%" style="stop-color:rgb(255,0,0);
stop-opacity:1"/>
</linearGradient>
</defs>

<rect x="15" y="15" width="120" height="120" 
fill="url(#awesome)" />

</svg>
Any help would be appreciated.

P.S., This is one of a growing number of problems I've had with converting SVG's with gradients, and I posted this in hopes of starting with the smallest problem first. I'm new to these forums, and to keep with good etiquette, when I post new (but related) problems, should I post them in separate posts? Or as replies to a previous topic I created on the subject?

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

Re: SVG, diagonal gradients not working

Post by magick »

We have infa-structure for gradients but it is not complete yet. If you have a modern install of librsvg, ImageMagick will detect it at build time and convert all SVG using it instead of the built-in renderer.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: SVG, diagonal gradients not working

Post by anthony »

Magick (cristy), is there some easy way to determine if the IM a user has, is using the librsvg library, or using the builtin svg->mvg conversion?

That is other than trying to convert a SVG with a gradient!
For example my own IM returns a diagonal gradient, so must be using librsvg (which is installed and I do built Im myself), but that is not simple test.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: SVG, diagonal gradients not working

Post by magick »

For the ImageMagick 6.3.3.1 release, we'll associate librsvg with the SVG tag for the identify -list format command. If its not mentioned, ImageMagick is using the internal MVG renderer.
Post Reply