summaryrefslogtreecommitdiff
path: root/packages/supertux/files/img-resize.sh
blob: 0197964193cc07b70c8c4b818a293536c63040ef (plain)
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
#!/bin/sh

conv() {

if [ ! -d org ]; then
    mkdir org
    mv *.jpg *.png org/
fi

for i in org/*; do
	b=`basename $i`
	ext=`expr "x$b" : 'x.*\.\(.*\)'`
	if [ "$ext" == "png" ]; then
	    if [ $b == "tux-life.png" ]; then
		cp $i _.png
	    else
		convert $i -resize 50% -colors 64 _.png
	    fi
	    pngcrush -q _.png $b
	elif [ "$ext" == "jpg" ]; then
		convert $i -resize 50% -quality 60 $b
	fi
done
rm _.png

}

conv