1
votes

Here's an Imagemagick command for retrieving pixel values from an image foo.tiff:

convert foo.tiff [1x1+40+30] -format %[fx:int(65535*r)],%[fx:int(65535*g)],%[fx:int(65535*b)] info:-

How do I format this to make it acceptable to the Tcl 'exec' command? I've tried a variety of escaping the various characters, enclosing in braces, and so on. I appreciate the advice...

2

2 Answers

1
votes

Tcl will do the right thing if you split that string into a list:

set cmd {convert foo.tiff [1x1+40+30] -format %[fx:int(65535*r)],%[fx:int(65535*g)],%[fx:int(65535*b)] info:-}
exec {*}[split $cmd]
1
votes

Personally, I'd just quote the bits that must not be substituted with {}:

exec convert foo.tiff {[1x1+40+30]} -format {%[fx:int(65535*r)],%[fx:int(65535*g)],%[fx:int(65535*b)]} info:-