summarylogtreecommitdiffstats
path: root/detex-thumbnailer
blob: 3530b5567fa9df91ffe15ad9a27f12132e5bd40f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh -e
tmpdir="$(mktemp -d)"
trap '{ rm -r "$tmpdir"; }' EXIT
mime="$(xdg-mime query filetype "$2")"
type="${mime#*/}"
if [ "$type" == "x-dds" ]; then type=dds; fi
# detex-convert requires the extension to be accurate
input="$tmpdir/input.$type"
output="$tmpdir/output.png"
ln -s "$2" "$input"
detex-convert "$input" "$output"
gdk-pixbuf-thumbnailer -s "$1" "$output" "$3"