1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/bin/bash
#
# Copyright 2007 Erlend Davidson <Erlend.Davidson@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# modified by David D Lowe <DavidDLowe.flimm@gmail.com>, all his changes are released
# into the public domain http://creativecommons.org/licenses/publicdomain/
#
# ooo-thumbnailer
# usage:
# ooo-thumbnailer file outfile
# command line parameters
ifile=$1
ofile=$2
size=$3
test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs
if [ `dirname $ifile` != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then
if [ -e /usr/bin/convert ]; then
unzip -p "$ifile" Thumbnails/thumbnail.png | convert - +matte "png:$ofile" #-scale "$sizex$size"
else
cache=${XDG_CACHE_HOME:-$HOME/.cache}
mkdir -p "$cache"
unzip "$ifile" Thumbnails/thumbnail.png -d "${cache}"
totem-gstreamer-video-thumbnailer "${cache}/Thumbnails/thumbnail.png" "$ofile" -s $size
fi
# uncomment the following line to include the OpenOffice.org logo in the thumbnail, requires imagemagick
#composite -gravity SouthEast /usr/share/icons/hicolor/48x48/mimetypes/openofficeorg3-oasis-text.png "$ofile" "$ofile"
fi
|