Skip to content

Instantly share code, notes, and snippets.

@JoshM1994
Last active January 14, 2018 14:49
Show Gist options
  • Save JoshM1994/0481b41d4bc83e15af3dc49b8424943d to your computer and use it in GitHub Desktop.
Save JoshM1994/0481b41d4bc83e15af3dc49b8424943d to your computer and use it in GitHub Desktop.
Use ImageMagick to filter out overly dark photos
#!/bin/bash
# Simple script used for filtering out photos taken on a timelapse camera
# Used in conjuction with [removeBlurry.sh](https://gist.github.com/JoshM1994/8ab288466500c26e7fcc62a388249abe)
mkdir -p tooDark
for f in `ls | sort -Vr`; do
AVG=$(convert $f -colorspace HCL -format '%M avg=%[fx:mean.g*1000] peak=%[fx:maxima.g]\n' info: | awk 'END {print $2}')
AVG=${AVG:4:5}
ISOK=$(echo "${AVG} > 1" | bc)
if [ ${ISOK} -eq 0 ]
then
echo "Moving $f"
mv $f tooDark/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment