Skip to content

Instantly share code, notes, and snippets.

@zhigang1992
Last active August 15, 2018 03:59
Show Gist options
  • Save zhigang1992/e84e162e5bbfa641eb013bccd35692c5 to your computer and use it in GitHub Desktop.
Save zhigang1992/e84e162e5bbfa641eb013bccd35692c5 to your computer and use it in GitHub Desktop.
Watermarking folders of images. imagemagick required
#!/bin/bash
# Put your files in origin folder
cd `dirname $0`
mkdir -p watermarked/origin
find origin -type d > watermarked/.dirs.txt
pushd watermarked
cat .dirs.txt | sed 's/.*/"&"/' | xargs mkdir -p
rm .dirs.txt
popd
find origin -type f \( -name "*.jpg" -or -name "*.png" -or -name "*.jpeg" \) -exec composite -tile watermark.png "{}" "watermarked/{}" \;
mv watermarked/origin/* watermarked/
rm -r watermarked/origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment