i have question regarding the convert and linux command in generate. i need to convert images using imagemagick

i do:

convert -quiet -regard-warnings image.jpg -colorspace RGB +repage /tmp/tempfile.img

that works

now, when i do:

convert $tmpA1 -median 2 -clut $tmpA2

i get:

convert: missing an image filename `/tmp/cartoon_2_17950.mpc' @ error/convert.c/ConvertImageCommand/2970.

after 3 day of searching i found this:

convert \( $tmpA1 -median 2 \) -clut $tmpA2

and it works

what is the purpose of the ( and )??

1 Answer 1


Parenthesis limit the scope of an action. In this case it applies the median filter to just this input image, and then does something with that. You can read more about this in the manual (scroll down to Image Stack) and here's the extract:

In school, your teacher probably permitted you to work on problems on a scrap of paper and then copy the results to your test paper. An image stack is similar. It permits you to work on an image or image sequence in isolation and subsequently introduce the results back into the command line. The image stack is delineated with parenthesis. Image operators only affect images in the current stack.

  • so convert $tmpA1 -median 2 | convert -clut $tmpA2 will be the equivalent? Jan 25, 2012 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.