How to insert a caption below an image?

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
Chemist116
Posts: 7
Joined: 2017-05-31T09:28:04-07:00
Authentication code: 1151

How to insert a caption below an image?

Post by Chemist116 »

Hello. I am trying to reproduce the effect similar to the example attached. I've already read the tutorial here however the result is not the desired. Can somebody help me with this?.
Image
What i need is that the text to be in courier new typeface and fontcolor to be yellow instead of white as in the example, but the rest is fine as black background color and to be centered in the near bottom of the picture.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to insert a caption below an image?

Post by fmw42 »

Do you want the text inside the image at or near the bottom or added below the bottom of the image.

What is your ImageMagick version and platform/OS, since syntax may differ?

Try something like:

Code: Select all

convert input.suffx -gravity south -undercolor black -fill yellow -font courier -pointsize 18 -annotate +0+20 "This Is Some Text" result.suffix
Chemist116
Posts: 7
Joined: 2017-05-31T09:28:04-07:00
Authentication code: 1151

Re: How to insert a caption below an image?

Post by Chemist116 »

fmw42 wrote: 2017-05-31T09:55:33-07:00 Do you want the text inside the image at or near the bottom or added below the bottom of the image.

What is your ImageMagick version and platform/OS, since syntax may differ?

Try something like:

Code: Select all

convert input.suffx -gravity south -undercolor black -fill yellow -font courier -pointsize 18 -annotate +0+20 "This Is Some Text" result.suffix
I want to make if possible a replica of the example provided just that the blackbox has to have yellowfont color and to be it courier new. It has to be positioned near the bottom inside the image exactly as the example. I'm using windows 7 and the version of image magick im on is imagemagick 6.9.3-2-q16-hdri-x86-dll, which way do you recommend?.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: How to insert a caption below an image?

Post by GeeMack »

Chemist116 wrote: 2017-05-31T13:09:30-07:00I want to make if possible a replica of the example provided just that the blackbox has to have yellowfont color and to be it courier new. It has to be positioned near the bottom inside the image exactly as the example. I'm using windows 7 and the version of image magick im on is imagemagick 6.9.3-2-q16-hdri-x86-dll, which way do you recommend?.
The command fmw42 showed you should do almost exactly that. Where he has "input.suffx" you need to put the name of your input image, and where he used "result.suffix" you'll put whatever name you want for your output image.

You might have to run a few tests to see how far up from the bottom you want it. Adjust that in the "-annotate" operation by increasing or decreasing the second number where the example has a 20. That "+0+20" would put your label centered left to right and 20 pixels up from the bottom.

Also, on a Windows system you might need to use "-font courier-new" instead of just "-font courier".
Post Reply