File indexing completed on 2024-05-19 15:22:31
0001 #!/bin/bash 0002 0003 sizes="128 64 48 32 22 16" 0004 folders="actions apps devices filesystems mimetypes" 0005 smallexport="yes" 0006 date=`date '+%F-%H-%M'` 0007 curdir=$(pwd)'/' 0008 icon=$1 0009 usingGui="true" 0010 max_small="48" 0011 0012 if [ "$icon" == "" ]; then 0013 icon=$(kdialog --getopenfilename $curdir) 0014 else 0015 icon=$curdir$icon 0016 usingGui="false" 0017 fi 0018 0019 iconName=$(basename $icon) 0020 iconDir=$(basename `dirname $icon`) 0021 iconPngName=$( echo $iconName | cut -d . -f -1 )".png" 0022 0023 inkscape --without-gui --export-png=$iconPngName --export-dpi=72 --export-background-opacity=0 --export-width=512 --export-height=512 $icon > /dev/null 0024 0025 for size in $sizes; do 0026 prefix="../${size}x${size}" 0027 # ====== shall we use a small icon if available? 0028 if [ $size -le $max_small ]; then 0029 smallicon="$iconDir/small/${size}x${size}/$iconName" 0030 if [ -e $smallicon ]; then 0031 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 0032 0033 else 0034 convert -filter Sinc -resize ${size}x${size} $iconPngName "../"${size}x${size}"/"$iconDir"/"$iconPngName 0035 fi 0036 else 0037 convert -filter Sinc -resize ${size}x${size} $iconPngName "../"${size}x${size}"/"$iconDir"/"$iconPngName 0038 fi 0039 echo "Converted the icon named "$( echo $iconName | cut -d . -f -1 )" to size: " $size 0040 done 0041 0042 rm $iconPngName 0043 0044 for size in $sizes; do 0045 svn add "../"${size}x${size}"/"$iconDir"/"$iconPngName 0046 done 0047 0048 if $usingGui; then 0049 kdialog --msgbox "Icon converted and added to SVN" 0050 else 0051 echo "Icon converted" 0052 fi