3

I am creating a bash script. How can I perform a set of operations/transformations (of choice) on all .jpg images in a different directory using ImageMagick's convert utility ? The converted image should be named *-change.jpg

Here's my code:

convert $file/*.jpg -flip $file/*-change.jpg
4

You can set the output file name via -set + some percent escapes (in this case you need the directory component of the path %d and the file name without extension %t):

convert "${dir}"/*.jpg -flip -set filename:t '%d/%t-change' '%[filename:t].jpg'

I used t as a filename:property but really, you can use whatever you want...

  • that was quick answer. thanks can you please explain what is %d/%t – maria Oct 30 '16 at 18:30
  • 1
    @maria - I've edited the post but if you follow the link in my answer you'll find the description for all percent escapes... – don_crissti Oct 30 '16 at 18:35

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.