Advertisement
Guest User

Untitled

a guest
Sep 15th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # This script assumes that ImageMagick is installed and the convert command is accessible via the $PATH variable
  3.  
  4. # Ensure that one argument has been passed in.
  5. if [ ! "$#" -eq 1 ]
  6. then
  7. echo -e "This script requires one argument.\\ne.g. iOS_icon_maker.sh app_icon.png"
  8. exit 1
  9. fi
  10.  
  11. # Assign the argument to the path variable so it is easier to follow throughout the script.
  12. path=$1
  13.  
  14. # Ensure that the path points to a valid file.
  15. if [ ! -f "$path" ]
  16. then
  17. echo "Path must point to a valid file."
  18. exit 1
  19. fi
  20.  
  21. # This function takes in the dimension of the icon (it assumes the icon is a square) and the name of the file to save the icon to.
  22. function createIconImage()
  23. {
  24. iconDimension=$1
  25. iconName=$2
  26.  
  27. convert "$path" -resize ${iconDimension}x${iconDimension}^ -gravity center -extent ${iconDimension}x${iconDimension} $iconName
  28. }
  29.  
  30. # Create all the suggested icons for both the iPhone and iPad platforms to ensure the best appearance.
  31.  
  32. # iOS 8.0+
  33. # iPhone 6 Plus
  34. createIconImage 180 icon-60@3x.png
  35.  
  36. # iOS 7.0+
  37. # iPhone / iPod Touch
  38. createIconImage 60 icon-60.png
  39. createIconImage 120 icon-60@2x.png
  40.  
  41. # ipad
  42. createIconImage 76 icon-76.png
  43. createIconImage 152 icon-76@2x.png
  44.  
  45. # iOS 6.1
  46. # Spotlight iCon
  47. createIconImage 40 icon-40.png
  48. createIconImage 80 icon-40@2x.png
  49.  
  50. # iPhone / iPod Touch
  51. createIconImage 57 icon-57.png
  52. createIconImage 114 icon-57@2x.png
  53.  
  54. # iPad
  55. createIconImage 72 icon-72.png
  56. createIconImage 144 icon-72@2x.png
  57.  
  58. # iPhone Spotlight and Settings Icon
  59. createIconImage 29 icon-29.png
  60. createIconImage 58 icon-29@2x.png
  61.  
  62. # iPad Spotlight and Settings Icon
  63. createIconImage 50 icon-50.png
  64. createIconImage 100 icon-50@2x.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement