How to input text overlay from text 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
slacsteve
Posts: 2
Joined: 2015-05-14T05:37:06-07:00
Authentication code: 6789

How to input text overlay from text file

Post by slacsteve »

Newbie here. I've been searching but can't find an answer. I have a constantly updating voltage in a one line text file which I would like to put on an image. How do I do it?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to input text overlay from text file

Post by Bonzo »

One important feature of IM is that it can read the text data to use from a file. This is done by prefixing the filename with an 'at' character '@', and using this as the string argument.
For example, here we create a label from my workstations 'message of the day' file...

convert -background lightblue -fill blue \
label:@/etc/motd label_file.gif
I would guess you can do the same thing with -annotate or -draw
slacsteve
Posts: 2
Joined: 2015-05-14T05:37:06-07:00
Authentication code: 6789

Re: How to input text overlay from text file

Post by slacsteve »

Great thanks. Here is what I finally will use for positioning various text on the image:

convert pccfield.jpg -pointsize 18 -annotate +50+50 @battvolts.txt label_file.gif

@ was the key I needed.

I appreciate your quick response. Soon I will be dangerous!
Post Reply