"-shadow" can be used instead with "-composite", but it then seems to ignore the x and y offsets.
The following Windows script creates a test case. test_shad.png (a black square within a massive transparent border) is shadowed in three diferent ways, showing that the offset -5-5 is ignored for composite, but this creates an identical result to +4+4 for layers merge.
The final two tests show that composite does respect the shadow opacity and sigma.
Code: Select all
%IM%convert ^
-size 600x600 xc:None ^
-fill Black -draw "rectangle 275,275 325,325" ^
test_shad.png
%IM%convert ^
test_shad.png ^
( +clone -background Blue ^
-shadow 80x2-5-5 ^
) ^
+swap ^
-background None -layers merge ^
test_s0.png
%IM%convert ^
test_shad.png ^
( +clone -background Blue ^
-shadow 80x2-5-5 ^
) ^
+swap ^
-background None -composite ^
test_c.png
%IM%convert ^
test_shad.png ^
( +clone -background Blue ^
-shadow 80x2+4+4 ^
) ^
+swap ^
-background None -layers merge ^
test_sL4.png
%IM%compare -metric RMSE test_c.png test_sL4.png NULL:
rem Result is zero difference.
rem Following shows that composite respects shadow opacity.
%IM%convert ^
test_shad.png ^
( +clone -background Blue ^
-shadow 20x20-5-5 ^
) ^
+swap ^
-background None -composite ^
test_c20f.png
rem Following shows that composite respects shadow sigma.
%IM%convert ^
test_shad.png ^
( +clone -background Blue ^
-shadow 80x20-5-5 ^
) ^
+swap ^
-background None -composite ^
test_c20.png