Hi everyone... I thought I'd share this inkscape/bash script (you must be using BASH since it uses shopt) Feel free to edit it to your own likings :) I added comments in to explain what is going on (comments in Bash are # EXCEPT the first line.. so my comments are ## to make it more clear)
#!/bin/bash shopt -s nullglob ##this is where the icons I want are iconDir=/usr/share/icons/Numix-Circle/48x48/apps ##this is where I want them to go... $HOME is like using ~/ from a terminal destDir=$HOME/tmp/Numix/result ##change to whatever the iconDir directory is cd "$iconDir" ##make a variable called putfiles and store all the SVGs putfiles=(*.svg) ##This is the size I want to scale them down to size=32x32 ##print this notice out take note that you can print the value of a variable to the screen by using the $ in front echo "This will convert the SVG files to $size" ##here is the for loop... For file (this is a new variable called file) in the variable called putfiles which is an array for file in "${putfiles[@]}"; do ##print out which file is being processed (so you don't think your computer just froze up and died echo "Processing $file" ## originally I used convert (imagemagick) but come on, inkscape it AWESOME inkscape --export-png=${destDir}/${file%???}png --export-dpi=200 --export-background-opacity=0 --without-gui ${iconDir}/${file} ## the most notable thing is the ${file%???} this saves the same filename (the SVG) minus 3 characters(svg) and adds png on the end ##of course --without-gui is VERY important ##remind the user where they are being saved echo "Saved to $destDir/$file" done ## FINALLY!!!!!!!!! wow, 2000+ files takes a while echo "Done!" So you run this from the directory you save it into... I call it: SVGtoPNG.sh run it like so ./SVGtoPNG.sh ./ executes a local executable.... you could also run it differently using bash... but this is the fastest way to run it. Believe me, if you are converting over 2000 images you do not want to open inkscape over and over :) -- Regards -- Mailing list: https://launchpad.net/~torios Post to : torios@lists.launchpad.net Unsubscribe : https://launchpad.net/~torios More help : https://help.launchpad.net/ListHelp