POSIX_Scripts/iview

29 lines
444 B
Plaintext
Raw Normal View History

2021-06-29 23:22:57 -04:00
#!/bin/sh -e
type=$(file --mime-type "${1}" | cut -f 2 -d ' ')
case "${type}" in
*image/png*)
x=$(/bin/file "${1}" | /bin/grep -o "[0-9]* x [0-9]*" | sed 's/ x /x/')
;;
*image/jpeg*)
x=$(/bin/file "${1}" | /bin/grep -o "[0-9]*x[0-9]*" | sed "2!d")
;;
*)
x=$(/bin/file "${1}" | /bin/grep -o "[0-9]* x [0-9]*" | sed 's/ x /x/')
;;
esac
2021-08-19 15:25:29 -04:00
if [ -x /bin/sxiv ]
then
/bin/sxiv -bg "${x}" "${1}"
else
2021-08-19 19:43:36 -04:00
/bin/meh "${1}"
2021-08-19 15:25:29 -04:00
fi
2021-06-29 23:22:57 -04:00
exit