我有一个 bash 脚本,它会自动为文件夹中的每个图像添加水印。
WATERMARK="$HOME/Dropbox/logo_bw.png"
if [ ! -e "watermarked_tmp" ]
then
mkdir watermarked_tmp
fi
#loop inside all the images in folder
for image in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG
do
if [ ! -e "$image" ] # Check if file exists.
then
continue
fi
#Retrieve size of the image and divide the lenght by 2
size=`identify -format %[fx:w/4,279] $image`
#Apply the watermark and create a new image in the "watermarked" subfolder
composite -dissolve 10% -quality 100 -gravity SouthEast -background none \( $WATERMARK -geometry ${size} \) ${image} watermarked_tmp/${image}
done
我想使用 Automator 从此代码创建一个文件夹操作。有人知道如何传递当前目录及其文件吗?我试着做,但它失败了for image in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG