Guest User

Untitled

a guest
Apr 25th, 2019
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # [!! WARNING]
  4. # This script will remove some icons from the original set.
  5. # It's probably best if you make a copy of the original
  6.  
  7. # USAGE:
  8. # Run this script from the within the Faenza icon directory that contains
  9. # each different category of icon (apps, categories, places, etc...)
  10.  
  11. # Depends on the ImageMagick convert tool
  12.  
  13. convert_icons()
  14. {
  15. mkdir -p 128
  16. mkdir -p 256
  17.  
  18. find 96/ -name "*.png" -type f -print0 | while read -d $'\0' icon
  19. do
  20. name="$(basename ${icon} .png)"
  21.  
  22. # 128x128
  23. convert -background none -density 96 "scalable/${name}.svg" "128/${name}.png"
  24.  
  25. # 256x256
  26. convert -background none -density 192 "scalable/${name}.svg" "256/${name}.png"
  27. done
  28.  
  29. mkdir -p ico
  30. list="$(find {16,22,24,32,48,64,96,128,256}/*.png -type f -exec basename {} \; | sort | uniq)"
  31.  
  32. for icon in ${list}
  33. do
  34. # Error messages are redirected to null since it's possible that the
  35. # icon doesn't exist in all of the size directories
  36. convert -quiet "./16/${icon}" "./22/${icon}" "./24/${icon}" "./32/${icon}" "./48/${icon}" "./64/${icon}" "./96/${icon}" "./128/${icon}" "./256/${icon}" "./ico/${icon%.*}.ico" 2> /dev/null
  37. done
  38. }
  39.  
  40. # Remove duplicate icons
  41. echo "Removing duplicate icons (symlinks)"
  42. find . -type l -exec rm {} \;
  43. echo
  44.  
  45. # Convert icon sets
  46. for folder in actions apps categories devices emblems mimetypes places status stock
  47. do
  48. cd ${folder}
  49. echo -e " \e[00;32m=>\e[00m Converting ${folder} to .ico files"
  50. convert_icons;
  51. cd ..
  52. done
RAW Paste Data