Reputation: 3625
I tried to flip horizontally the images in a specific folder using ImageMagik. But the mogrify -flop *jpg
is changing all the images in their mirror images. I want to keep the initial images and for the flopped ones I want to rename them as *_flop.jpg
. I am stuck: How to do it?
Upvotes: 0
Views: 1477
Reputation: 533
Update:
For newer versions of ImageMagick (version 7 onwards) you do not need to write:
convert -flop
Instead you need to write:
magick -flop
So your script essentially becomes:
#!/bin/bash/
for file in *.jpg
do
magick $file -flop ${file%%.jpg}_flop.jpg
done
Note: This works when your filenames don't have spaces or newlines in them.
Upvotes: 1
Reputation: 207758
Assuming you are on Linux or OSX, like this:
#!/bin/bash
for f in *.jpg; do
new="${f%%.jpg}_flop.jpg"
echo convert "$f" -flop "$new"
done
At the moment, it does nothing, it just tells you what it would do. If you like what it shows, just remove the word echo
and run it again.
Save the code above as flopper
, and then go to Terminal and type this:
chmod +x flopper # Just do this one time to make the script executable (runnable)
./flopper # Actually run it
Upvotes: 2