Mercurial > jpeg-exif-thumbnailer
view jpeg-exif-thumbnailer @ 0:92c70579720e default tip
Initial commit
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Wed, 13 Jan 2021 19:25:09 -0500 |
parents | |
children |
line wrap: on
line source
#!/bin/bash # Fast GNOME thumbnailer for JPEG files that uses the embedded EXIF thumbnail # from the source file, if present. Greatly speeds up thumbnail generation when # browsing a folder of images shared over a network. # # Usage: # jpeg-exif-thumbnailer [size] [source] [destination] set -e # Transform the input file URI (for example, file://... or smb://...) into its # locally mounted path. input_path=$(gio info "$2" | grep "^local path:" | cut -d ' ' -f 3-) # Use exiftool to extract the embedded preview image. exiftool -a -b -W! "$3" -preview:all "$input_path" if [ -s "$3" ]; then # If the extraction succeeded, convert the extracted image to the requested # format based on the requested file extension, and resize it to the # requested size. Since Nautilus requires PNG files, the mogrify command # is required even if -resize is not specified. mogrify -resize $1x$1 "$3" else # If the extraction failed, fall back to the default system thumbnailer. /usr/bin/gdk-pixbuf-thumbnailer -s "$1" "$2" "$3" fi