I have a background picture. Now I want to draw a rounded rectangle with a text shaped hole on it. Do I have to draw a mask pic first?
Update: I want the picture show through the text, but not the rounded rectangle. My convert command version is 6.9.7, on Linux.
Sorry, I am still not sure I understand what you want for the round rectangle. But here is one method that computes a white round rectangle, puts transparent text in it, then overlays that on the lena background image.
convert \( -size 150x150 xc:white \) \
\( +clone -alpha extract \
-draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
\( +clone -flip \) -compose Multiply -composite \
\( +clone -flop \) -compose Multiply -composite \
\) -alpha off -compose CopyOpacity -composite \
\( -size 100x100 -background none -fill white -gravity center \
-pointsize 36 -font arial label:"TEST" \) \
-gravity center -compose dstout -composite -alpha on \
lena.png +swap -compose over -composite tmp.png