how to do a transparent gradient?
Posted: 2008-01-17T16:04:32-07:00
In my last thread I asked a suggestion to draw a 3D cylinder. Bonzo, that I thank, has stimulated me to study the draw syntax. My solution is:
The result is ok for me.
Now, since I want to make the cylinder transparent, I need some type of gradient where one color is none (that is, transparent).
Unfortunately, it seems to me that I have not well understood how to use the gradient: option.
I tried without success the following command:
and this other one:
(I work on a Windows XP machine, sorry)
Let me say that I copied the -fx argument from an example in page http://www.imagemagick.org/Usage/canvas ... ent_resize.
Even if I type the command exactly as it is reported in the example,
I obtain the same error message.
Furthermore, this example draws a horizontal symmetric gradient, even if I need a vertical one. Since it is not clear for me the meaning of i and w, I am not able to modify the formula inside parenthesis to obtain the effect I want.
Thanks for your help and your patience.
Your program is wonderful.
Code: Select all
convert -size 120x60 xc:none -fill none -stroke black -draw "roundrectangle 5,5,115,55 25,25" -draw "roundrectangle 5,5,55,55 25,25" cyl1.png
Now, since I want to make the cylinder transparent, I need some type of gradient where one color is none (that is, transparent).
Unfortunately, it seems to me that I have not well understood how to use the gradient: option.
I tried without success the following command:
Code: Select all
convert cyl1.png gradient:none-white -flatten gradient.png
convert: Must specify image size `none-white'
Code: Select all
convert cyl1.png -fx 'cos(pi*(i/w-0.5))' -flatten gradient.png
convert: unable to parse expression `cos(pi*(i/w-0.5))'
Let me say that I copied the -fx argument from an example in page http://www.imagemagick.org/Usage/canvas ... ent_resize.
Even if I type the command exactly as it is reported in the example,
Code: Select all
convert rose: -fx 'cos(pi*(i/w-.5))' gradient_fx_cos.gif
Furthermore, this example draws a horizontal symmetric gradient, even if I need a vertical one. Since it is not clear for me the meaning of i and w, I am not able to modify the formula inside parenthesis to obtain the effect I want.
Thanks for your help and your patience.
Your program is wonderful.