Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / pics / oxygen / scalable / export_pngs.sh
blob984bee5e1471d4d3a5e052c181e3cf0e03e25702
1 #!/bin/bash
3 sizes="128 64 48 32 22 16"
4 folders="actions apps devices filesystems mimetypes"
5 smallexport="yes"
6 smallsizes="16 22"
7 date=`date '+%F-%H-%M'`
8 curdir=$(pwd)'/'
9 icon=$1
10 usingGui="true"
11 min_small="25"
13 if [ "$icon" == "" ]; then
14 icon=$(kdialog --getopenfilename $curdir)
15 else
16 icon=$curdir$icon
17 usingGui="false"
20 iconName=$(basename $icon)
21 iconDir=$(basename `dirname $icon`)
22 iconPngName=$( echo $iconName | cut -d . -f -1 )".png"
24 inkscape --without-gui --export-png=$iconPngName --export-dpi=72 --export-background-opacity=0 --export-width=512 --export-height=512 $icon > /dev/null
26 for size in $sizes; do
27 prefix="../${size}x${size}"
28 # ====== shall we use a small icon if available?
29 if [ $size -le $min_small ]; then
30 smallicon="$iconDir/small/${size}x${size}/$iconName"
31 if [ -e $smallicon ]; then
32 inkscape --without-gui --export-png="../"${size}x${size}"/"$iconDir"/"$iconPngName --export-dpi=72 --export-background-opacity=0 --export-width=$size --export-height=$size $smallicon > /dev/null
34 else
35 convert -filter Sinc -resize ${size}x${size} $iconPngName "../"${size}x${size}"/"$iconDir"/"$iconPngName
37 else
38 convert -filter Sinc -resize ${size}x${size} $iconPngName "../"${size}x${size}"/"$iconDir"/"$iconPngName
40 echo "Converted the icon named "$( echo $iconName | cut -d . -f -1 )" to size: " $size
41 done
43 rm $iconPngName
45 for size in $sizes; do
46 svn add "../"${size}x${size}"/"$iconDir"/"$iconPngName
47 done
49 if $usingGui; then
50 kdialog --msgbox "Icon converted and added to SVN"
51 else
52 echo "Icon converted"