Try:


convert \( -size 100x100 gradient:red \) \
        \( +clone -colorspace Gray -gamma 1.0 \) \
        +matte -compose Copy_Opacity -composite out.png

The first line creates a 100x100 red gradient.
The second line converts a copy to grayscale and modified it by the non-linear function gamma. With gamma=1.0 there is no change. Gamma can be larger or smaller than 1.0. Gamma greater than 1 is similar to an exp and gamma less than 1 is similar to log ( I may have that backwards, but you get the idea). If you want some other function you can replace -gamm with -fx "somefunction" The third line places the modified grayscale gradient into the transparency channel of the red gradient.

If you want to take an existing color gradient and place it over another image, then try something like

convert backgroundimage \
        \( gradientimage -colorspace Gray -gamma 1.0 \) \
        +matte -compose Copy_Opacity -composite out.png

Assuming the background and gradient images are the same size.



I'm seeking for a general solution to allow for producing gradients
from color to transparency either linearly or (even better) after
some function (exp or other).

Reason behind is producing shadows for images or weblayouts over
their respective background image so that I get a smooth
transition from some opaque shadow to transparency.

Thanks a lot in advance.


--
Chris Christoph P. U. Kukulies
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to