Best way to add "padding" to "caption:@-" ?

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
webunity

Best way to add "padding" to "caption:@-" ?

Post by webunity »

Hi,

What is the best way if i need to use "caption:@-" (for wrapping) but also want to add some padding?

For instance;
- I want to write a very long text, which is first wrapped in imagemagick to e.g. 500x18px
- Then i want to add 10 pixels to each size (basically; gravity: center) so the image becomes 520x38px

But i also want to be able to specify different padding to each side, meaning i can't use gravity "center" just like that..
For instance;
lets say i have an image that is 500x18px but i only want to add 10px to the left of the image, and 4px to the right of the image, meaning the image would become 514x18px..

How can you do that with "convert"? Below you find my current "test" commandline:

Code: Select all

echo -n "PHP will attempt to execute the contents of the backticks as a shell command; the output will be returned (i.e., it won't simply be dumped to output; it can be assigned to a variable)." | convert -background none -size 512x -fill '#ff3300' -font './coopbl.ttf' -pointsize 18 -gravity NorthWest caption:@-
I have imagemagick version 6.3.7
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Best way to add "padding" to "caption:@-" ?

Post by fmw42 »

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Best way to add "padding" to "caption:@-" ?

Post by anthony »

To add padding to BOTH sides, use -border 10x0
for adding it to ALL sides use -border 10
Splice will add padding bot only to one side or in the middle (sic).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply