Skip to content

Instantly share code, notes, and snippets.

@ntrrgc
Created August 11, 2015 23:28
Show Gist options
  • Save ntrrgc/d9998ecc400d35c21bba to your computer and use it in GitHub Desktop.
Save ntrrgc/d9998ecc400d35c21bba to your computer and use it in GitHub Desktop.
Find images susceptible of being used as wallpaper
#!/bin/bash
min_ratio=$(bc -l <<< 4/3)
max_ratio=$(bc -l <<< 20/9)
min_height=720
images=()
for f in *.png *.jpg; do
read ratio height <<<$(identify -format '%[fx:w/h] %[fx:h]' "$f")
if (( $(bc <<< "$ratio >= $min_ratio && $ratio <= $max_ratio \
&& $height >= $min_height") == 1)); then
echo "$f"
images+=("$f")
fi
done
feh --geometry 1366x768 --image-bg black "${images[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment