how to read file to caption: *without* modifying @ policy.xml

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
fredzannarbor
Posts: 1
Joined: 2017-02-01T14:57:48-07:00
Authentication code: 1151

how to read file to caption: *without* modifying @ policy.xml

Post by fredzannarbor »

Hi,

I need to create a caption using text from a file but *without* modifying the policy.xml. What is a workaround?

Code: Select all

convert -background white -fill black -gravity west -size 2000x2000 -font "Utopia" -pointsize "64" caption:@sumall.txt sumall3.png
produces:

Code: Select all

convert: not authorized `@/tmp/pagekicker/028c5142-e8b2-11e6-ace4-02607828b875/sumall.txt' 
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: how to read file to caption: *without* modifying @ policy.xml

Post by snibgo »

As a workaround, build the command from the contents of the file. I would do this via an environment variable in Windows. In bash, you can embed a "cat" command within the convert.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to read file to caption: *without* modifying @ policy.xml

Post by fmw42 »

In unix, do

Code: Select all

data=`cat file.txt`
convert -size 100x100 -font arial -pointsize 18 label:"$data" result.png
Or this seems to work for me

Code: Select all

cat test.txt | convert -size 100x100 -font arial -pointsize 18 label:@- result.png
Same should work for caption:
Post Reply