Skip to content

Commit

Permalink
Explicitely handle gif previews
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-arch committed Oct 26, 2023
1 parent 28179b5 commit 5431489
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions misc/tools/imgprev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The first parameter (thumbnailing method) could be any of the following:

* image
* video
* gif
* epub
* pdf
* djvu
Expand All @@ -80,6 +81,7 @@ X:^application/epub\+zip$=clifmimg epub;
X:^application/pdf$=clifmimg pdf;
X:^image/vnd.djvu=clifmimg djvu;
X:^image/svg\+xml$=clifmimg svg;
X:^image/gif$=clifmimg gif;
X:^image/.*=clifmimg image;
X:^video/.*=clifmimg video;
X:^audio/.*=clifmimg audio;
Expand Down
17 changes: 12 additions & 5 deletions misc/tools/imgprev/clifmimg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#X:.*/pdf$=clifmimg pdf
#X:^image/vnd.djvu=clifmimg djvu
#X:^image/svg\+xml$=clifmimg svg;
#X:^image/gif$=clifmimg gif;
#X:^image/.*=clifmimg image;
#X:^video/.*=clifmimg video;
#X:^audio/.*=clifmimg audio;
Expand All @@ -57,13 +58,13 @@
# The following applications are used to generate thumbnails:
# ffmpegthumbnailer (Video files)
# epub-thumbnailer (ePub files)
# pdftoppm (PDF files, provided by the poppler package)
# ddjvu (DjVu files, provided by the djvulibre package)
# pdftoppm (PDF files - provided by the poppler package)
# ddjvu (DjVu files - provided by the djvulibre package)
# ffmpeg (Audio files)
# fontpreview (Font files)
# libreoffice (Office files: odt, docx, xlsx, etc)
# gs (Postscript files, provided by the ghostscript package)
# convert (SVG files and sixel images, provided by the imagemagick package)
# gs (Postscript files - provided by the ghostscript package)
# convert (GIF, SVG files, and sixel images - provided by the imagemagick package)
#
# Note: The exact package names provinding these programs vary depending
# on your OS/distribution, but ususally they have the same name as the program
Expand All @@ -85,7 +86,7 @@ hash_file() {
PCACHE="$CACHE_DIR/$(md5 -q "$1")"
else
printf "clifm: No hashing application found.\nEither md5sum or md5 \
are required.\n" >&2
is required.\n" >&2
exit 1
fi
}
Expand Down Expand Up @@ -151,6 +152,12 @@ display() {
main() {
case "$type" in
"image") display "$file" ;;
"gif")
hash_file "$file"
! [ -f "${PCACHE}.jpg" ] && \
convert -coalesce -resize 640x480\> "$file"[0] "${PCACHE}.jpg"
display "${PCACHE}.jpg"
;;
"video")
hash_file "$file"
! [ -f "${PCACHE}.jpg" ] && \
Expand Down

0 comments on commit 5431489

Please sign in to comment.