Page 1 of 1

How to indent text?

Posted: 2013-09-21T18:53:12-07:00
by ClumsyNinja
Hi everyone.

I am using IM ImageMagick-6.8.3-Q16 CLI via Macro Scheduler to create thousands of web buttons. The following code works perfectly, except I want to move the text 4 pixels to the right, so it isn't justified up against the left edge. How would I do this, please?

Without the Macro Scheduler code :
convert -background yellow -fill black -size 495x35 -pointsize 31 -gravity west -font Arial-Bold label:TEST 2013-test-yellow2.gif

With the Macro Scheduler code :
run program>"%IMexepath%\convert" -background yellow -fill black -size 495x35 -pointsize 31 -gravity west -font Arial-Bold label:TEST %IMdocpath%\2013-test-yellow2.gif


Many thanks in advance, and thank you for an amazing program!

ClumsyNinja

Re: How to indent text?

Posted: 2013-09-21T20:15:25-07:00
by snibgo
There are many ways. One is:

Code: Select all

convert -background yellow -fill black -pointsize 31 -gravity west -font Arial-Bold label:TEST -extent 495x35-4+0 y.gif
One tip, if you don't care exactly how many pixels are used for padding, is to add a space in the label, eg:

Code: Select all

convert -background yellow -fill black -size 495x35 -pointsize 31 -gravity west -font Arial-Bold label:" TEST " 2013-test-yellow2.gif

Re: How to indent text?

Posted: 2013-09-22T11:19:13-07:00
by ClumsyNinja
That's fantastic! Thank you very much. The first solution was perfect.

I ended up using -extent 495x35-3-1 and managed to place the text exactly where I needed it.

This is the final code, in case it helps anyone else.

With Macro Scheduler code (in case anyone else here uses it)

Code: Select all

run program>"%IMexepath%\convert" -background yellow -fill black -size 495x35 -pointsize 31  -gravity west -font Arial-Bold label:%artistname% -extent 495x35-3-1 %IMdocpath%\2012-biggs-collings-yellow2.gif
Without Macro Scheduler code

Code: Select all

convert -background yellow -fill black -size 495x35 -pointsize 31  -gravity west -font Arial-Bold label:TEST -extent 495x35-3-1 c:\TEST.gif

Re: How to indent text?

Posted: 2014-08-12T20:48:47-07:00
by abs2act
Is there a way to use different pixel indents if I am using multiple sentences for my image?

Re: How to indent text?

Posted: 2014-08-12T21:41:03-07:00
by fmw42
Create each image separately with each line of text and indent as needed. Then append the images vertically (-append). You can add borders to each separate image before appending if you want spacing. See -border or -splice or -extent at http://www.imagemagick.org/Usage/crop/.

You can do this all in one command if you use parenthesis processing. See http://www.imagemagick.org/Usage/basics/#parenthesis

Re: How to indent text?

Posted: 2014-08-12T22:35:18-07:00
by abs2act
Thanks for the reply fmw42!