Skip to content

Commit

Permalink
Handle animated webp same as gif
Browse files Browse the repository at this point in the history
That is, only explode into individual frames if the file is specified on the command line. Otherwise, just show the first frame.
  • Loading branch information
hackerb9 authored Nov 15, 2023
1 parent e49fc61 commit e158896
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lsix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Requirements: just ImageMagick (and a Sixel terminal, of course)

# Version 1.8
# B9 August 2021
# Version 1.8.1
# B9 November 2023

# See end of file for USAGE.

Expand Down Expand Up @@ -188,13 +188,13 @@ main() {
if [[ $# == 0 ]]; then
# No command line args? Use a sorted list of image files in CWD.
shopt -s nullglob nocaseglob nocasematch
set -- *{jpg,jpeg,png,gif,webp,tiff,tif,p?m,x[pb]m,bmp,ico,svg,eps}
set -- *{jpg,jpeg,png,,webp,tiff,tif,p?m,x[pb]m,bmp,ico,svg,eps}
[[ $# != 0 ]] || exit
readarray -t < <(printf "%s\n" "$@" | sort)

# Only show first frame of animated GIFs if filename not specified.
for x in ${!MAPFILE[@]}; do
if [[ ${MAPFILE[$x]} =~ gif$ ]]; then
if [[ ${MAPFILE[$x]} =~ (gif|webp)$ ]]; then
MAPFILE[$x]="${MAPFILE[$x]}[0]"
fi
done
Expand Down

0 comments on commit e158896

Please sign in to comment.