add padding to texts with convert

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
suman114
Posts: 13
Joined: 2016-04-17T23:51:39-07:00
Authentication code: 1151

add padding to texts with convert

Post by suman114 »

I am adding text with annotate, but the text is not centered and attached to the top.
Also how do we add a padding to increase the background size and center the text?
My command is:

Code: Select all

convert myPdf.pdf -gravity southwest -fill "rgba(0,0,0,0.80)" -pointsize 10 -annotate +0+0 "This is my text." compose -multiply myDestination.pdf
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: add padding to texts with convert

Post by snibgo »

Use a different gravity, eg "North" or "Centre".

What padding do you want to increase?

Your final "compose -multiply" is strange. Perhaps you intended "-compose multiply", but is isn't followed by anything that would be affected.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: add padding to texts with convert

Post by fmw42 »

I would suggest you create a text image using label: or caption: with a given background and -gravity center, trim it, then pad with the background color, then composite it over your other image at the desired location. See http://www.imagemagick.org/Usage/text/
Post Reply