Captioning existing images

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
string_theorist
Posts: 5
Joined: 2013-04-30T00:27:12-07:00
Authentication code: 6789

Captioning existing images

Post by string_theorist »

This is obviously a simple, amateur question, but I have failed in solving.

I have existing images that needs text to be inserted as captions. I am writing in Batch.

for /F "tokens=1-4 DELIMS=#" %%n in ('type %textSourcePath%') do if "%%n"==" " (

%imageMagickPath%\convert.exe "%imageSourcePath%\%%o.jpg" -interline-spacing -7 -background blue -fill white -strokewidth 2 -stroke black -pointsize 40 +repage -bordercolor blue -border 15 -size 580X420 -gravity South -font C:\Users\user\Downloads\fontor_perspective-sans\persanbk.ttf caption:"%%o\n%%p" "%imageDestPathUNC%\DSC00%%q.jpg"

It fails when trying to run this.

I think i have some fundamental flaws in my understanding of this programs operation.

Thanks for the support.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Captioning existing images

Post by snibgo »

"caption:" creates a new image. So your command reads an image (%o.jpg), then creates another image (the caption, but you would need to spefify the size), then writes to a single .PNG.

You either need to combine the two images (see "composite"), or write the text directly on the image you have read (see "annotate" or "draw").

http://www.imagemagick.org/script/comma ... ptions.php
snibgo's IM pages: im.snibgo.com
Post Reply