Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Directory thumbnails. Avoid memory limits in ImageMagick using subprocesses.
#!/bin/bash
set -eu -o pipefail
CMD="$(mktemp)"
for DIR in "$@"
do
echo "set -xe; montage \\" > "$CMD"
find "$DIR" -type f -name '*g' \
| while read FILE
do
echo "png:<( convert -resize 150x150 '$FILE' png:- ) \\" >> "$CMD"
done
echo "$DIR".jpeg >> "$CMD"
bash "$CMD"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment