diff --git a/file_previewer.sh b/file_previewer.sh index 15f8069..b0aaecc 100755 --- a/file_previewer.sh +++ b/file_previewer.sh @@ -1,7 +1,7 @@ #!/bin/sh # File preview handler for lf using the Perl `mimetype` utility. -preview_image="/tmp/lf_preview_image.jpg" +preview_image="/tmp/lf_preview_image.png" file=$1 width=$2 @@ -34,9 +34,9 @@ case "$(mimetype --brief -- "$file")" in exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; video/*) - ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 "$preview_filepath" - chafa "$preview_filepath" --size="$(($width-4))"x"$height" - rm "$preview_filepath" # removing preview file so that lf looks for a new preview image instead of going for an old one + ffmpeg -ss 00:00:00 -i "$file" -frames:v 1 -q:v 2 "$preview_image" + chafa "$preview_image" --size="$(($width-4))"x"$height" + rm "$preview_image" # removing preview file so that lf looks for a new preview image instead of going for an old one exiftool "$file" | bat --theme='base16' --terminal-width "$(($width-4))" --force-colorization;; image/*)