/ Published in: Bash

This crude script will export individual icons from an SVG file when using a single canvas workflow, especially for Tango Desktop style icons.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash # # Usage: tangoexport.sh [svg file] # # Script assumes it will be executed in a directory above tango/ # # Input filename convention: [section]_[prefix]_[name].svg # I.e, apps_accessories_calculator.svg for apps/accessories-calculator.png # # Edit the colon-delimited coordinates according to your source file (see the # Inkscape command line documentation)). # inputfile=$1 inputbase=`basename $inputfile .svg` oldifs=$IFS IFS='_' set -- $inputbase section=$1 prefix=$2 piece=$3 IFS=$oldifs inkscape=`which inkscape` for size in "16x16/0:0:16:16" "22x22/-30:0:-8:22" "32x32/-70:0:-38:32" "48x48/-126:0:-78:48" do oldifs=$IFS IFS="/" set -- $size iconsize=$1 coords=$2 IFS=$oldifs command="${inkscape} -f $inputfile -z -e tango/${iconsize}/${section}/${prefix}}-${name}.png --export-area=${coords}" `${command}` echo done
Comments
