perform imagemagick rounded corners operation on all images in a folder
Posted: 2016-08-21T02:35:23-07:00
Hi, I've been trying to find a way to do this and have searched here and in google generally.
I've pretty well given up, after trying a heap of loops and other things, but I wondered if someone here might have actually worked it out.
I have the following saved as s shell script and it works perfecly. But I need to run it on perhaps a dozen files each time (more or less). No matter what I do I cannot find anything to add to the script that doesn't result in a mess.
I need obviously, to have each file renamed as it is processed, which will involve variables, but it just ended up compositing all the png files into one image, or creating a whole lot of the same image with different file names.
I've been messing with it for a few hours each day for a week and I'm beginning to think it is impossible using imagemagick, and considering a gimp batch file or something.
I messed with mogrify as well, but couldn't find a way to make it do all the relevant bits, so I went back to convert.
Thanks for looking. I hope someone has a solution. How it should work is the same as most of the other stuff I do. I just drop a heap of files of various sizes into a folder, click the script and go make a coffee.
Cheers,
RossD
I've pretty well given up, after trying a heap of loops and other things, but I wondered if someone here might have actually worked it out.
I have the following saved as s shell script and it works perfecly. But I need to run it on perhaps a dozen files each time (more or less). No matter what I do I cannot find anything to add to the script that doesn't result in a mess.
I need obviously, to have each file renamed as it is processed, which will involve variables, but it just ended up compositing all the png files into one image, or creating a whole lot of the same image with different file names.
I've been messing with it for a few hours each day for a week and I'm beginning to think it is impossible using imagemagick, and considering a gimp batch file or something.
I messed with mogrify as well, but couldn't find a way to make it do all the relevant bits, so I went back to convert.
Code: Select all
#!/bin/bash
convert *.jpg \
\( +clone -alpha extract \
-draw 'fill black polygon 0,0 0,45 45,0 fill white circle 45,45 45,0' \
\( +clone -flip \) -compose Multiply -composite \
\( +clone -flop \) -compose Multiply -composite \
\) -alpha off -compose CopyOpacity -composite rounded-corners-45.png
convert -page +20+20 rounded-corners-45.png -alpha set \
\( +clone -background black -shadow 60x20+20+20 \) +swap \
-background none -mosaic shadow-soft.png
convert shadow-soft.png -unsharp 10x4+1+0 shadow-soft-unsharp.png
convert shadow-soft-unsharp.png -resize 600 shadow-soft-600.png
mv shadow-soft-600.png output
rm rounded-corners-45.png
rm shadow-soft.png
rm shadow-soft-unsharp.png
mv *.jpg processed
cd output
geeqie shadow-soft-600.png
Cheers,
RossD