Export Tango Icons From Single Canvas


/ Published in: Bash
Save to your folder(s)

This crude script will export individual icons from an SVG file when using a single canvas workflow, especially for Tango Desktop style icons.


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2. #
  3. # Usage: tangoexport.sh [svg file]
  4. #
  5. # Script assumes it will be executed in a directory above tango/
  6. #
  7. # Input filename convention: [section]_[prefix]_[name].svg
  8. # I.e, apps_accessories_calculator.svg for apps/accessories-calculator.png
  9. #
  10. # Edit the colon-delimited coordinates according to your source file (see the
  11. # Inkscape command line documentation)).
  12. #
  13.  
  14. inputfile=$1
  15. inputbase=`basename $inputfile .svg`
  16. oldifs=$IFS
  17. IFS='_'
  18. set -- $inputbase
  19. section=$1
  20. prefix=$2
  21. piece=$3
  22. IFS=$oldifs
  23. inkscape=`which inkscape`
  24.  
  25. for size in "16x16/0:0:16:16" "22x22/-30:0:-8:22" "32x32/-70:0:-38:32" "48x48/-126:0:-78:48"
  26. do
  27. oldifs=$IFS
  28. IFS="/"
  29. set -- $size
  30. iconsize=$1
  31. coords=$2
  32. IFS=$oldifs
  33. command="${inkscape} -f $inputfile -z -e tango/${iconsize}/${section}/${prefix}}-${name}.png --export-area=${coords}"
  34. `${command}`
  35. echo
  36. done

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.