Caption inside Bounding Box

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
ophelius
Posts: 3
Joined: 2015-10-06T18:46:20-07:00
Authentication code: 1151

Caption inside Bounding Box

Post by ophelius »

Hi there,
Is there a way to define a bounding box for the Caption option? Right now I have this:

convert -alpha on -background #00000050 -fill white -size 800x600 -gravity Center caption:"Test 1 2 3" png32:temp.png

and this centers the text nicely using the largest font possible. But let's say I wish to define a smaller area inside my image for the text so it doesn't extend all the way to the sides and top and bottom. For example, the final image is 800x600, but I never want text to be displayed outside an imaginary box of 700x550 located at the centre of the image, sort of like padding for the text. I hope that makes sense.

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

Re: Caption inside Bounding Box

Post by fmw42 »

You need to create the text file with -size 700x550 and then composite it over your larger image or use -extent or -border to expand the size of the text image. See http://www.imagemagick.org/Usage/crop/#border and http://www.imagemagick.org/Usage/crop/#extent
Post Reply