Created
August 11, 2015 23:28
-
-
Save ntrrgc/d9998ecc400d35c21bba to your computer and use it in GitHub Desktop.
Find images susceptible of being used as wallpaper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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