Using stacks in ImageMagick to selectively blur parts of an image

I am trying to comment on text in a base image using dropshadow. I don’t like the results that I get from using the -shadow option, so I put the text, blurring it, and then again put the text in white, a few pixels offset from the shadow. Here's the command I'm using:

convert base_image.jpg \
        -font TT0590M_.ttf \
        -fill gray30 \
        -annotate +0+0 '' -gravity North \
        -annotate +72+32 'ABCDEFGHIJKLM' \
        -blur 0x4 \
        -fill white \
        -annotate +72+27 'ABCDEFGHIJKLM' \
        combined.png

My problem is that the -blur option blurs not only the first layer of text, but also the underlying base image. I want the first layer of text to blur, not the base image.

I read a little about using stacks and tried to isolate the first layer of text and the blur command, using \( \)around this part, for example, in the following:

convert base_image.jpg \
        -font TT0590M_.ttf \
        -fill gray30 \
        -annotate +0+0 '' -gravity North \
        \( -annotate +72+32 'ABCDEFGHIJKLM' \
        -blur 0x4 \) \
        -fill white \
        -annotate +72+27 'ABCDEFGHIJKLM' \
        combined.png

- , . , , , , .

+3
1

, , , .

, , . , , , , "", .

: RGBA-, - , IM. , .

, Windows (.bat script) , "\" "^", .

script - (* nix-):

convert  \
    -size 500x500 xc:transparent \
    -font TT0590M_.ttf \
    -annotate +0+0 '' -gravity North \
    -fill gray30 \
    -annotate +75+35 'ABCDEFGHIJKLMNOPQR\nABCDEFGHIJKLMNOPQR' \
    -channel RGBA \
    -blur 0x4 \
    -fill white \
    -annotate +72+30 'ABCDEFGHIJKLMNOPQR\nABCDEFGHIJKLMNOPQR' \
    -insert 0 base_image.jpg \
    -swap 0,1 \
    -composite -compose screen \
    combined.png
+7

All Articles