user254694
user254694

Reputation: 1612

Escape [0] in ImageMagick label

I am generating a number of imagemagick commands to write out labels, one of the labels I need to write is the following:

[0]

whenever I get to the command with this label it does not work.

This is the specific command

convert -background white -fill black -font Arial -pointsize 24 label:[0] -rotate 90 16.png 

when I run this in my Mac terminal I get the message

convert: no images defined `16.png' @ error/convert.c/ConvertImageCommand/3282.

I have of course tried to escape with a backslash but neither

label:[0]

or

label:\[\0\]

or

label:[\0]

or

label:\[0\]

work, and each gives the same error. Any suggestions?

Upvotes: 1

Views: 89

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208003

Try:

convert -pointsize 36 label:'\[0\]' image.png

The single quotes prevent the shell from seeing/interpreting the square brackets as a bracket expression and the backslashes prevent ImageMagick from believing they are part of an fx-like expression.

Upvotes: 1

Related Questions