Skip to content

Instantly share code, notes, and snippets.

@uriel1998
Last active August 19, 2023 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uriel1998/402bebb02d071039032d77f286b2c40d to your computer and use it in GitHub Desktop.
Save uriel1998/402bebb02d071039032d77f286b2c40d to your computer and use it in GitHub Desktop.
fehview.sh -- uses feh, gifview, and heif-convert to get quick previews
#!/bin/bash
# uses gifview: https://linux.die.net/man/1/gifview
# uses heif-convert: https://pypi.org/project/heif-convert/
shopt -s nullglob
if [[ ! -f $1 ]]; then
notify-send "ERROR"
echo "$0: first argument is not a file" >&2
exit 1
fi
if [[ "$1" =~ .*.heic ]];then
tmpfile=$(echo "$(mktemp).jpg")
heif-convert -q 75 "${1}" "${tmpfile}"
bob=$(feh --auto-zoom --scale-down --geometry 640x480 "${tmpfile}")
rm "${tmpfile}"
else
if [[ "$1" =~ .*.gif ]];then
gifview -a "$1"
else
bob=$(feh --auto-zoom --scale-down --geometry 640x480 "$1")
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment