Page 1 of 1
radial-gradient issue in mvg files
Posted: 2015-07-07T11:26:03-07:00
by rocastro
I tried to draw a circle whith radial gradient. From the comand line no problem.
convert -size 1000x1000 xc:white -fill radial-gradient:"hsl(0,255,60)"-"hsl(0,255,120)" -draw "circle 500,500,500,750" draw_circle.png
When I put the command in a mvg file, then imagemagick crash whith unrecognized color ´radial-gradient´:
convert -size 1000x1000 xc:white -draw @draw_circle.mvg draw_circle.png
And the draw_circle.mvg file is:
fill radial-gradient:"hsl(0,255,60)"-"hsl(0,255,120)" circle 500,500,500,750
I tried more combinations and nothing:
fill radial-gradient:hsl(333,0,231)-hsl(333,0,226) circle 1000,1000,647,1353
fill "radial-gradient:hsl(333,0,231)-hsl(333,0,226)" circle 1000,1000,647,1353
fill "radial-gradient:hsl(333,0,231)"-"hsl(333,0,226) circle 1000,1000,647,1353
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T11:38:10-07:00
by snibgo
rocastro wrote:-draw @draw_circle.mvg
The contents of the file draw_circle.mvg needs to be valid syntax for the "-draw" command.
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T11:45:09-07:00
by rocastro
If the mvg file is:
fill "hsl(0,255,60)" circle 500,500,500,750
Then no problem.
It's no posible to use fill radial-gradient in mvg files?
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T12:30:06-07:00
by snibgo
You can put anything you want in any file you want.
But if you want to use the file in ...
... then it needs to be valid syntax for the "-draw" command.
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T12:35:28-07:00
by rocastro
Please , can you help me with this problem , I'm new to the mvg language and this is not very well documented
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T13:46:22-07:00
by snibgo
Please don't multi-post. It just confuses people.
For MVG documentation, see
http://www.imagemagick.org/script/magic ... aphics.php
But within a "-draw @file.ext" file, you don't use MVG. You use draw syntax. See
http://www.imagemagick.org/script/comma ... s.php#draw
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T14:12:26-07:00
by rocastro
Sorry for the multi-post.
Thank's I have this information but I can't paint a gradient from a mvg file. I'm tring the linear gradient from the link whith MVG Gradients:
http://www.linux-nantes.org/~fmonnier/OCaml/MVG/
But it doesn't work. At the first line say:
'."\n"; ?>
And convert.exe say error: non-conforming drawing primitive definition '."\n"; ?>
if I remove this line it doesn't work. I'm tried changing the quotes and nothing
If I remove the first line, then convert paint stripes not a gradient.
This is the mvg file:
push graphic-context
viewbox 0 0 260 180
affine 1 0 0 1 0 0
push defs
push gradient "linearGradient_A" linear 0.4,0 0.6,1
stop-color "#ee1122" 0
stop-color "#ddaa44" 0.6
stop-color "#4488ff" 1
pop gradient
pop defs
push graphic-context
fill "url(#linearGradient_A)"
rectangle 0,0 260,180
pop graphic-context
pop graphic-context
Re: radial-gradient issue in mvg files
Posted: 2015-07-07T14:59:13-07:00
by rocastro
Searching older posts I found this:
viewtopic.php?t=17031
http://www.imagemagick.org/Usage/draw/#svg
I tried the mvg file of the example on this link and it works Ok whith linear gradient:
Code: Select all
push graphic-context
viewbox 0 0 1000 1000
affine 1 0 0 1 0.0 0.0
push defs
push gradient 'gradient' linear 0,0 1000,1000
stop-color 'rgb(255,255,0)' 0%
stop-color 'rgb(255,0,0)' 100%
pop gradient
pop defs
push graphic-context
fill 'url(#gradient)'
rectangle 0,0 1000,1000
pop graphic-context
pop graphic-context
But if the gradient is radial it doesn't work:
Code: Select all
push graphic-context
viewbox 0 0 1000 1000
affine 1 0 0 1 0.0 0.0
push defs
push gradient 'gradient' radial 500,500 500,500, 250
stop-color 'rgb(255,255,0)' 0%
stop-color 'rgb(255,0,0)' 100%
pop gradient
pop defs
push graphic-context
fill 'url(#gradient)'
rectangle 0,0 1000,1000
pop graphic-context
pop graphic-context
Re: radial-gradient issue in mvg files
Posted: 2015-07-08T02:01:42-07:00
by rocastro
The svg version of radial gradient works Ok.
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
x="0" y="0"
width="1000" height="1000"
xml:space="preserve">
<defs id="def_A">
<radialGradient id="Gradient_B"
gradientUnits="userSpaceOnUse"
cx="500" cy="500" r="250" fx="500" fy="500">
<stop offset="0" stop-color="rgb(255,255,0)" />
<stop offset="1" stop-color="rgb(255,0,0)" />
</radialGradient>
</defs>
<circle id="circle_A"
cx="500" cy="500"
r="250"
style="fill:url(#Gradient_B);" />
</svg>
But the converted version to mvg doesn't work
Code: Select all
push graphic-context
encoding "UTF-8"
viewbox 0 0 1000 1000
affine 1 0 0 1 0 0
push defs
push gradient 'Gradient_B' radial 500,500 500,500 250
gradient-units 'userSpaceOnUse'
stop-color 'rgb(255,255,0)' 0
stop-color 'rgb(255,0,0)' 1
pop gradient
pop defs
push graphic-context
fill 'url(#Gradient_B)'
circle 500,500 500,750
pop graphic-context
pop graphic-context
Re: radial-gradient issue in mvg files
Posted: 2015-07-08T05:30:37-07:00
by snibgo
This sounds like a bug. A developer would need to comment.
Re: radial-gradient issue in mvg files
Posted: 2015-07-08T07:42:34-07:00
by rocastro
Ok, thanks.
Re: radial-gradient issue in mvg files
Posted: 2015-07-12T11:03:29-07:00
by dlemstra
It took a while but we figured out what was going on. There was no support for a radial gradient. It would always be a linear gradient but you would not notice that because of the second set of coordinates. You should do this instead:
Code: Select all
push gradient 'Gradient_B' radial 500,500 0,0 250
But then you will notice it looks odd and that is because the wrong coordinates are being used when the gradient is drawn inside the circle. We fixed both issues and this will be available in the beta of 6.9.1-9 some time tomorrow.
We also added support for more than two stop colors in ImageMagick 7. We won't be adding this to ImageMagick 6 for now but that won't be a problem in your situation.
Re: radial-gradient issue in mvg files
Posted: 2015-07-12T15:05:12-07:00
by rocastro
Okay, thanks for your time and review the problem. Imagemagick is a great program for image treatment through commands.