#!/bin/dash
# Create thumbnail for PDF files.
# $1-path to source, $2-path to output, $3-thumb size (pixel)

# Alternative 1: Needs no additional packages.
# Letter => 128x166 RGBA
#exec 2>/dev/null
exec evince-thumbnailer -s "$3" "$1" "$2"

# Alternative 2: needs mupdf package. More flexible and accurate.
# Letter => 99x128 RGB (omit -h for 128x166)
#exec mutool draw -iL -w "$3" -h "$3" -o "$2" -s5 "$1" 1 2>/dev/null

# Alternative 3: using pdftocairo, no external dependencies needed
#exec pdftocairo -singlefile -scale-to "$3" "$1" -png "${2%.*}"
