hasanghaforian
hasanghaforian

Reputation: 14022

montage command of ImageMagick does not read from file

I use Ubuntu 14.0.4. We can use this command to label each image by it's name:

montage -label '%t' -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png

I want to label images by list of strings, which is written in a text file. Docs say:

-label name

Use this option to assign a specific label to the image ... If the first character of string is @, the image label is read from a file titled by the remaining characters in the string. Labels in a file are literal, no embedded formatting characters are recognized.

But I could not use a file to provide label. I use a command like this:

montage -label @un.txt -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png 

Above, un.txt is the name of text file in ./img/ path. This is a sample result:

enter image description here

In result, all images labeled by string @un.txt instead of content of un.txt. Also I get this error in terminal:

montage.im6: improper image header `./img/un.txt' @ error/txt.c/ReadTXTImage/429

If I move un.txt to the current (.) directory and run above command again, I will get this image (there is no label) and below error:

enter image description here

montage.im6: not authorized `@un.txt' @ error/property.c/InterpretImageProperties/2959.

Note:

  1. All images are jpg
  2. The version of ImageMagick is ImageMagick 6.7.7-10

Upvotes: 1

Views: 1281

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207540

Updated Answer

Maybe you have the wrong syntax for label:

convert -size 100x100 xc:red label:@label.txt -append result.png

enter image description here

where label.txt contains fred.

Original Answer

It is probably related to the vulnerability discovered in ImageMagick, see here.

You will need to update your site policy file. You can discover the location by running this:

convert -debug configure logo: null: 2>&1 | grep -Ei "Searching|Loading"

and it will be in the same directory/folder as the other XML config files.

Upvotes: 1

Related Questions