compose positioning of Text

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
KandisZZ
Posts: 21
Joined: 2011-02-13T05:47:57-07:00
Authentication code: 8675308

compose positioning of Text

Post by KandisZZ »

Hello IM Forum.
I need some help again with the position of text.

I have a fixed size canvas like 400x40.
This is what i have at the moment:
Image
Text1 and Text2 are all positioned absolute from left.

Code:

Code: Select all

 convert -size 635x35 xc:yellow  -background none -fill '#123456'  -pointsize 14 caption:'Text1' -geometry +$marginleftvar+5 -composite   -background none -pointsize 14 caption:'OtherText' -geometry +$marginleftvar+20 -composite PNG:-   

What i need:
Image
boxes with Text positioned with -gravity and or -geometry inside the boxes.Then append on the fixed size canvas.



thx for your help and greetings.

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

Re: compose positioning of Text

Post by fmw42 »

try putting -geometry before the caption.

However, I am not sure any of label:, caption:, or -draw are geometry sensitive. They are gravity sensitive. So you may need to use -gravity or else try -annotate to be able to fine position your text.

try this:

convert -size 70x70 xc:yellow -font Arial \
-fill green -pointsize 9 -gravity northwest -annotate +0+0 "Text1" \
-fill blue -pointsize 11 -gravity east -annotate +0+0 "Text2" \
-fill blue -pointsize 13 -gravity southeast -annotate +0+0 "Text3" \
tmp.png

or this:

convert \( -size 70x70 xc:yellow -font Arial \
-fill green -pointsize 9 -gravity northwest -annotate +0+0 "Text1" \
-fill blue -pointsize 11 -gravity east -annotate +0+0 "Text2" \
-fill blue -pointsize 13 -gravity southeast -annotate +0+0 "Text3" \
-gravity east -background wheat -splice 5x0 \) \
+clone +clone +clone +clone +append -gravity east -chop 5x0 tmp2.png


see http://www.imagemagick.org/Usage/text/

How did you produce the result you wanted? Did you use IM or something else?
KandisZZ
Posts: 21
Joined: 2011-02-13T05:47:57-07:00
Authentication code: 8675308

Re: compose positioning of Text

Post by KandisZZ »

Thx for your Ideas.
The examples were made with Photoshop :)

I search for a possibility to append the 70x70 box
on a canvas with a size for example 400x70.

But the append command put the boxes on the right of the canvas.

Is there a option to append the boxes on the canvas?

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

Re: compose positioning of Text

Post by fmw42 »

If you have a background image and want to place other images onto it, you would use

-flatten

see

http://www.imagemagick.org/Usage/layers/#flatten

the -page allows you to position the image on the background canvas

you could also do series of -compose ... -composite in the same command, just chain them together. That allows you to use -gravity and -geometry or just one or the other.

see

http://www.imagemagick.org/Usage/layers/#convert
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compose positioning of Text

Post by anthony »

Also see... Text to Image processing, Form filling...
http://www.imagemagick.org/Usage/text/#form_filling
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
KandisZZ
Posts: 21
Joined: 2011-02-13T05:47:57-07:00
Authentication code: 8675308

Re: compose positioning of Text

Post by KandisZZ »

Thx for the Ideas!
Helped a lot.

Marc.
Post Reply