images.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2015 Marcus Rohrmoser http://mro.name/me. All rights reserved.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. cd "$(dirname "$0")/build"
  19. inkscape=/Applications/Inkscape.app/Contents/Resources/bin/inkscape
  20. $inkscape --help >/dev/null 2>&1 || { echo "Inkscape is not installed." && exit 1; }
  21. optipng -help >/dev/null 2>&1 || { echo "optipng is not installed." && exit 1; }
  22. OPTS="--export-area-page --export-width=1024 --export-height=1024 --without-gui"
  23. src="../../shaarli-petal.svg"
  24. dst="iTunesArtwork.png"
  25. "$inkscape" --export-png="$(pwd)/$dst" $OPTS --file="$(pwd)/$src"
  26. optipng -o 7 "$(pwd)/$dst" &
  27. dst=iTunesArtwork.svg
  28. cp "$src" "$dst"
  29. # http://stackoverflow.com/a/10492912
  30. $inkscape "$(pwd)/$dst" \
  31. --select=layer3 --verb=EditDelete \
  32. --select=g4737 --verb=EditDelete \
  33. --select=layer2 --verb=EditDelete \
  34. --select=g3001 --verb=EditDelete \
  35. --select=layer1 --verb=EditDelete \
  36. --verb=FileVacuum --verb=FileSave \
  37. --verb=FileClose --verb=FileQuit
  38. $inkscape $OPTS --vacuum-defs --export-plain-svg="$(pwd)/$dst" --file="$(pwd)/$dst"
  39. img=iPhone-App
  40. siz=60
  41. sips --resampleHeightWidthMax "$(($siz * 1))" iTunesArtwork.png --out "$img.png"
  42. sips --resampleHeightWidthMax "$(($siz * 2))" iTunesArtwork.png --out "$img@2x.png"
  43. sips --resampleHeightWidthMax "$(($siz * 3))" iTunesArtwork.png --out "$img@3x.png"
  44. optipng -o 7 "$img*.png" &
  45. img=iPhone-Settings
  46. siz=29
  47. sips --resampleHeightWidthMax "$(($siz * 1))" iTunesArtwork.png --out "$img.png"
  48. sips --resampleHeightWidthMax "$(($siz * 2))" iTunesArtwork.png --out "$img@2x.png"
  49. sips --resampleHeightWidthMax "$(($siz * 3))" iTunesArtwork.png --out "$img@3x.png"
  50. optipng -o 7 "$img*.png" &
  51. img=iPhone-Spotlight
  52. siz=40
  53. sips --resampleHeightWidthMax "$(($siz * 1))" iTunesArtwork.png --out "$img.png"
  54. sips --resampleHeightWidthMax "$(($siz * 2))" iTunesArtwork.png --out "$img@2x.png"
  55. sips --resampleHeightWidthMax "$(($siz * 3))" iTunesArtwork.png --out "$img@3x.png"
  56. optipng -o 7 "$img*.png" &
  57. img=iPad-App
  58. siz=76
  59. sips --resampleHeightWidthMax "$(($siz * 1))" iTunesArtwork.png --out "$img.png"
  60. sips --resampleHeightWidthMax "$(($siz * 2))" iTunesArtwork.png --out "$img@2x.png"
  61. optipng -o 7 "$img*.png" &
  62. wait