Discussion:
Adding multiple annotation to an image with one command using "-gravity"
PLTK
2010-05-09 15:40:52 UTC
Permalink
Hello.

I am trying endlessly to add multiple annotations to an image but I
fail miserably.


What I want to do:

Place three texts in three different places on the image using just one command.


What I type:

convert image.png -pointsize 40 -fill white -gravity center -annotate
+100+150 MAINTITLE -gravity center -annotate +200+250 Text -gravity
center -annotate +300+350 logo image-with-text.png


What happens:

The first text ("MAINTITLE") is printed where I tell it to.
However, the two other texts are printed as if the "+250" and "+350"
parts are totally ignored.
The result is a file where "Text" and "logo" is next to each other on
the same line.


I know I am doing something wrong but what is it?

Thanks!

P.


PS: I have tried RTFM, using parentheses, using "-draw" but the same
thing happens.
Fred Weinhaus
2010-05-09 21:52:12 UTC
Permalink
This works fine for me on IM 6.6.1-7 Q16 Mac OSX Tiger.

convert -size 1000x1000 xc:white tmp.png
convert tmp.png -pointsize 24 -fill black -font Arial \
-gravity center -annotate +100+150 "MAINTITLE" \
-gravity center -annotate +200+250 "Text" \
-gravity center -annotate +300+350 "logo" tmp2.png


Is your input image large enough to have offsets as large as yours
from the center?

What version of IM are you using? if old, perhaps upgrade.


Fred
Anthony Thyssen
2010-05-10 01:08:19 UTC
Permalink
On Sun, 9 May 2010 18:40:52 +0300
magick-users-***@imagemagick.org wrote:

| Hello.
|
| I am trying endlessly to add multiple annotations to an image but I
| fail miserably.
|
|
| What I want to do:
|
| Place three texts in three different places on the image using just one command.
|
|
| What I type:
|
| convert image.png -pointsize 40 -fill white -gravity center -annotate
| +100+150 MAINTITLE -gravity center -annotate +200+250 Text -gravity
| center -annotate +300+350 logo image-with-text.png
|
|
| What happens:
|
| The first text ("MAINTITLE") is printed where I tell it to.
| However, the two other texts are printed as if the "+250" and "+350"
| parts are totally ignored.
| The result is a file where "Text" and "logo" is next to each other on
| the same line.
|
|
| I know I am doing something wrong but what is it?
|
| Thanks!
|
| P.
|
|
| PS: I have tried RTFM, using parentheses, using "-draw" but the same
| thing happens.
| _______________________________________________

The real problem is that -gravity not only defines 'justification'
but also 'positioning'. This is a real pain!




Anthony Thyssen ( System Programmer ) <***@griffith.edu.au>
--------------------------------------------------------------------------
The Macintosh Principle :-
Build a system that even a fool can use,
and only a fool will want to use it.
--------------------------------------------------------------------------
Anthony's Castle http://www.cit.griffith.edu.au/~anthony/

Loading...