comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:92c70579720e
1 #!/bin/bash
2
3 # Fast GNOME thumbnailer for JPEG files that uses the embedded EXIF thumbnail
4 # from the source file, if present. Greatly speeds up thumbnail generation when
5 # browsing a folder of images shared over a network.
6 #
7 # Usage:
8 # jpeg-exif-thumbnailer [size] [source] [destination]
9
10 set -e
11
12 # Transform the input file URI (for example, file://... or smb://...) into its
13 # locally mounted path.
14 input_path=$(gio info "$2" | grep "^local path:" | cut -d ' ' -f 3-)
15
16 # Use exiftool to extract the embedded preview image.
17 exiftool -a -b -W! "$3" -preview:all "$input_path"
18
19 if [ -s "$3" ]; then
20 # If the extraction succeeded, convert the extracted image to the requested
21 # format based on the requested file extension, and resize it to the
22 # requested size. Since Nautilus requires PNG files, the mogrify command
23 # is required even if -resize is not specified.
24 mogrify -resize $1x$1 "$3"
25 else
26 # If the extraction failed, fall back to the default system thumbnailer.
27 /usr/bin/gdk-pixbuf-thumbnailer -s "$1" "$2" "$3"
28 fi