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

1 Answer 1

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...

2
  • that was quick answer. thanks can you please explain what is %d/%t
    – maria
    Oct 30, 2016 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... Oct 30, 2016 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .