Annotate Image Ontop Of Other Images (with text effects)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Annotate Image Ontop Of Other Images (with text effects)

Post by myspacee »

Hello,
reading around some examples, but can't assemble code to obtain this :

Image

i create an image that contains a word with :

Code: Select all

convert -size 400x70 xc:lightblue -font Candice -pointsize 72 -annotate +25+65 "Contestati" -blur 0x5 -fill white -annotate +25+65 "Contestati" 02_my_words.png


then try to annotate, with trasparencies over original image:

Code: Select all

convert 01_original.jpg 02_my_words.png -colorspace sRGB -gravity southwest -geometry +3+3 -define compose:args=40,100 -compose dissolve -composite 99_final.jpg
but result is far from my above example.

Anyone can help me with syntax?

thank you,
m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Annotate Image Ontop Of Other Images (with text effects)

Post by fmw42 »

Put your text onto a transparent background, not a colored background or just annotate the text onto the image directly where you want it using -annotate.


Unix syntax:

try one of these. note it would have been easier if you had provided separate images. I had to cut out 01_original.png

Code: Select all

convert  01_original.png \
\( -size 400x75 xc:none -font Candice -pointsize 72 \
-fill white -annotate +25+65 "Contestati" -blur 0x5 \
-fill white -annotate +25+65 "Contestati" \) \
-gravity south -geometry +0+25 -compose over -composite 99_final_2.jpg

Code: Select all

convert 01_original.png \
\( -background none -font Candice -pointsize 72 \
-fill white label:"Contestati" -blur 0x5 \) \
\( -background none -font Candice -pointsize 72 \
-fill white label:"Contestati" \) \
\( -clone 1,2 -compose over -composite \) \
-delete 1,2 -gravity south -geometry +0+25 \
-compose over -composite 99_final_3.jpg

Code: Select all

convert  01_original.png \
\( -size 400x75 xc:none -font Candice -pointsize 72 \
-fill white -annotate +25+65 "Contestati" -blur 0x5 \
-fill white -annotate +25+65 "Contestati" \) \
-gravity south -geometry +0+25 \
-define compose:args=40,100 -compose dissolve -composite 99_final_4.jpg
Not sure why you want the dissolve?
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: Annotate Image Ontop Of Other Images (with text effects)

Post by myspacee »

thank you for reply,
can you post Windows code? Can't solve/convert syntax on my w2003 server.

thank you for your time,
m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Annotate Image Ontop Of Other Images (with text effects)

Post by fmw42 »

See http://www.imagemagick.org/Usage/windows/.

Change end of line \ to ^
Remove \ from before \( and \) so that it is just parentheses ( ... )

Example in Windows syntax:

Code: Select all

convert  01_original.png ^
( -size 400x75 xc:none -font Candice -pointsize 72 ^
-fill white -annotate +25+65 "Contestati" -blur 0x5 ^
-fill white -annotate +25+65 "Contestati" ) ^
-gravity south -geometry +0+25 -compose over -composite 99_final_2.jpg
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Annotate Image Ontop Of Other Images (with text effects)

Post by GeeMack »

If you put a black stroke around the first "annotate" before the "blur", the shadow effect will be more pronounced.

Code: Select all

convert 01_original.png ^
   ^( -size 400x100 xc:none -gravity south ^
      -font Candice -pointsize 72 -strokewidth 6 ^
      -fill black -stroke black ^
      -annotate +0+12 "Contestati" -blur 0x4 ^
      -fill white -stroke none ^
      -annotate +0+12 "Contestati" ^) ^
   -composite 99_final.jpg
And if you're running it from a Windows batch file instead of entering it on the command line (or pasting it in), you'll need to escape the parentheses with carets as I've done in the above example.
Post Reply