Update 2024-02-14 07:51 OpenBSD/amd64-x13
This commit is contained in:
47
.bin/OLD/xfilesthumb
Executable file
47
.bin/OLD/xfilesthumb
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
BACKGROUND="#0A0A0A"
|
||||
THUMBSIZE=64
|
||||
umask 077
|
||||
|
||||
case "$#" in
|
||||
(2)
|
||||
;;
|
||||
(*)
|
||||
printf "usage: %s file\n" "$0" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$2" in
|
||||
(*/*)
|
||||
mkdir -p "${2%/*}"
|
||||
;;
|
||||
(*)
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${1##*.}" in
|
||||
png|jpg|jpeg|gif|xpm|xbm|ppm)
|
||||
convert "${1}[0]" -background "$BACKGROUND" -flatten \
|
||||
-define filename:literal=true -format ppm \
|
||||
-thumbnail "${THUMBSIZE}x${THUMBSIZE}" \
|
||||
"${2}"
|
||||
;;
|
||||
webm|mp4|mkv|ogv)
|
||||
ffmpegthumbnailer -c png -i "${1}" -o - -s "${THUMBSIZE}" \
|
||||
| convert - -define filename:literal=true -format ppm \
|
||||
"${2}"
|
||||
;;
|
||||
svg)
|
||||
rsvg-convert -h "${THUMBSIZE}" "${1}" \
|
||||
| convert - -format ppm "${2}"
|
||||
;;
|
||||
pdf)
|
||||
pdftoppm -f 1 -l 1 -scale-to "${THUMBSIZE}" -singlefile \
|
||||
"${1}" "${2%.ppm}"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac 2>/dev/null
|
||||
Reference in New Issue
Block a user