text from a file

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: text from a file

Post by fmw42 »

I am no expert and have not verified any of these, but you can do

str=`cat textfile.txt`

Then try

convert -font helvetica -fill white -pointsize 80 -draw 'text 700,250 "$st" 172945.dpx 172945_new.cin

You can also try using -annotate 0 "$str"

or

composite label:"$str"

Putting double quotes around $str will keep each line separate (if you do echo "$str") whereas leaving off the quotes will run all the lines together into one string (if you do echo $str)




See http://www.imagemagick.org/Usage/annotating/#gravity
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: text from a file

Post by anthony »

String arguments can be read DIRECTLY from a file using "@filename" in label: caption: -annotate and -draw.

See IM examples, Text to Image handling
http://imagemagick.org/Usage/text/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply