How to draw text from file on an existing 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
jensen31
Posts: 8
Joined: 2016-01-01T16:15:43-07:00
Authentication code: 1151

How to draw text from file on an existing image

Post by jensen31 »

Hey there,

searching for hours... Maybe you can help me. I am on Debian.

I want to draw text from file.txt on my existing picture pic.jpg.
I do know only how to draw text, which is in the command itself, but not from text file or with variables.

Why? The picture is a webcam picture. and the text, that should be on the image is in a text file.

Who gives me the working hint first gets a coffee (5 €) via PayPal.:)

Thank you guys and happy new year.
Jens
jensen31
Posts: 8
Joined: 2016-01-01T16:15:43-07:00
Authentication code: 1151

Re: How to draw text from file on an existing image

Post by jensen31 »

got it on my own..

KATZE=aufEinemBeim
convert /skripte/dateien/bg.jpg -pointsize 34 -fill white -annotate +266+235 "$KATZE" /skripte/dateien/bg.jpg
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: How to draw text from file on an existing image

Post by GeeMack »

jensen31 wrote:I want to draw text from file.txt on my existing picture pic.jpg.
I do know only how to draw text, which is in the command itself, but not from text file or with variables.

Why? The picture is a webcam picture. and the text, that should be on the image is in a text file.

Who gives me the working hint first gets a coffee (5 €) via PayPal.:)
Save the text you want to draw in a file. Let's say the file is named "mywords.txt". Then to use that in your annotate command, put a "@" at the beginning of the text file name. IM will read the "mywords.txt" file and use its contents as the text. It will look something like this...

Code: Select all

convert /skripte/dateien/bg.jpg -pointsize 34 -fill white -annotate +266+235 @mywords.txt /skripte/dateien/bg_with_text.jpg
You can PayPal me at: gmcneil@yahoo.com
:)
Post Reply