#!/bin/bash echo Will convert a Icon Naming Convention compliant SVG Gnome or KDE icon echo theme to a usable bitweaver icon theme echo # Validate Input if [[ ( $1 == '--help' ) || ( $1 == '-h' ) || ( $1 == '?' ) ]] then echo "Usage: sh icon_theme_converter.sh [options] This script requires that rsvg is available (i.e.: librsvg is installed)." exit fi if [ rsvg ] then echo "'rsvg' was found in your \$PATH." else echo "rsvg could not be found in your \$PATH. Please download and install librsvg." exit fi dir='scalable' if [ -d "$dir" ] then for folder in `find ./$dir/ -maxdepth 1 -type d`; do folder=`basename $folder` if [[ "$folder" != $dir && $folder != 'CVS' ]]; then echo Converting $folder icons to png mkdir -p "./small/" mkdir -p "./large/" for icon in ./$dir/$folder/*.svg; do basename=${icon%.*} 2>>biticonification_error.log; basename=`basename $basename` 2>>biticonification_error.log; rsvg -w16 -h16 $icon "./small/${basename}.png" 2>>biticonification_error.log; rsvg -w32 -h32 $icon "./large/${basename}.png" 2>>biticonification_error.log; done; fi; done echo echo echo "Conversion from svg to png is done." else echo "Please copy this script to the theme you want to convert and run it from there. Make sure the svg directory is avalable and that it's called 'scalable'" fi echo echo echo Moving accross all specific non-scalable icons mv -f 16x16/*/*.png small/ 2>>biticonification_error.log; mv -f 32x32/*/*.png large/ 2>>biticonification_error.log; dirlist='small large' mydir='my_icon_theme' echo echo echo Making gif copies of all png icons echo The gif version is sent to Microsoft Internet Explorer to avoid transparency issues. echo echo Creating directory to hold the final version of the icon style mkdir -v $mydir for dir in $dirlist do echo echo Making gif copies in $dir/ filelist=`ls $dir` for file in $filelist do conv=`echo $file | perl -wpe 's/\.png//g'` convert $dir/$conv.png -channel A -threshold 50% $dir/$conv.gif 2>>biticonification_error.log; #convert $dir/$conv.png -channel A -threshold 65% -modulate 120,80,90 -fill "#99AAEE" -tint 50 -verbose $dir/$conv-tint.png 2>>biticonification_error.log; #convert $dir/$conv.png -modulate 100,100,50 -fill "#AACCFF" -tint 50 -verbose $dir/$conv-tint.png 2>>biticonification_error.log; #convert $dir/$conv.png -modulate 100,100,50 -verbose $dir/$conv-tint.png 2>>biticonification_error.log; done mv $dir $mydir/; done echo " All stages have been completed. You bitweaver compatible theme can be found in the $mydir directory. All you need to do now is insert the new icon style into your bitweaver installation and activate it in your Themes --> Themes Manager page: mv $mydir/ /path/to/bitweaver/themes/icon_styles/"