The mask is not needed, as it is part of original image. The shadow color looks to be "DeepPink"
The technique is explained in IM Examples, Shadow Images, and more specifically, Shadow outlines
http://www.imagemagick.org/Usage/blur/#shadow_outline
The tricky part however is to realise that a shadow blur works both inward and outward.
That when overlaying the glow, the shadow is 50% transparent. You want it opaque at the very edge.
This currently needs some extra processing.
Here is the solution...
Code: Select all
convert star.png \
\( +clone -background DeepPink -shadow 100x10+0+0 \
-channel A -level 0,50% +channel \
\) -background none -compose DstOver -flatten \
star_glow.png
Note I used a compose DstOver with Flatten as the shape already has enough space for the glow.
If it did not I would have just used
-layers merge +repage instead.
FUTURE:
I am thinking to modify the
-shadow operator so that it will accept larger values than 100% for shadow transparency. That is allow the use of
-shadow 200x10+0+0 in the above to
do the correct multiplication of the alpha channel after the blur, and removing the need for extra
-level operations. Currently this is not the case.
I am also thinking of treating a negative transparency that negates the shape before creating the shadow image, so as to allow the creating of 'inner shadows' for bordering shapes.
For IMv7 I am thinking of making the
-shadow operator to automatically apply shadows to the given image (in the appropriate way, with enlargement -- no clone needed), while making
+shadow simply create shadows (as it currently does) for DIY shadow effects. This last must be a IMv7 addition due to the simplified handling of the
-shadow operator. Otherwise the change would break many scripts.
Anyone else have thoughts on these changes.