Skip to content

Instantly share code, notes, and snippets.

@dusty
Created September 9, 2014 02:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dusty/93e97c3f55d65dd3be8a to your computer and use it in GitHub Desktop.
Save dusty/93e97c3f55d65dd3be8a to your computer and use it in GitHub Desktop.
Make cordova splash and icons from master files
#!/bin/bash
ICON_SRC="src/res/icon-master.png"
## ANDROID
ICON_DIR="build/platforms/android/res"
mkdir -p $ICON_DIR
convert $ICON_SRC -resize 36x36 "${ICON_DIR}/drawable-ldpi/icon.png"
convert $ICON_SRC -resize 48x48 "${ICON_DIR}/drawable-mdpi/icon.png"
convert $ICON_SRC -resize 72x72 "${ICON_DIR}/drawable-hdpi/icon.png"
convert $ICON_SRC -resize 96x96 "${ICON_DIR}/drawable-xhdpi/icon.png"
convert $ICON_SRC -resize 96x96 "${ICON_DIR}/drawable/icon.png"
## IOS
YOURAPP="XXXX"
ICON_DIR="build/platforms/ios/${YOURAPP}/Resources/icons"
mkdir -p $ICON_DIR
convert $ICON_SRC -resize 40x40 "${ICON_DIR}/icon-40.png"
convert $ICON_SRC -resize 80x80 "${ICON_DIR}/icon-40@2x.png"
convert $ICON_SRC -resize 50x50 "${ICON_DIR}/icon-50.png"
convert $ICON_SRC -resize 100x100 "${ICON_DIR}/icon-50@2x.png"
convert $ICON_SRC -resize 60x60 "${ICON_DIR}/icon-60.png"
convert $ICON_SRC -resize 120x120 "${ICON_DIR}/icon-60@2x.png"
convert $ICON_SRC -resize 72x72 "${ICON_DIR}/icon-72.png"
convert $ICON_SRC -resize 144x144 "${ICON_DIR}/icon-72@2x.png"
convert $ICON_SRC -resize 76x76 "${ICON_DIR}/icon-76.png"
convert $ICON_SRC -resize 152x152 "${ICON_DIR}/icon-76@2x.png"
convert $ICON_SRC -resize 29x29 "${ICON_DIR}/icon-small.png"
convert $ICON_SRC -resize 58x58 "${ICON_DIR}/icon-small@2x.png"
convert $ICON_SRC -resize 57x57 "${ICON_DIR}/icon.png"
convert $ICON_SRC -resize 114x114 "${ICON_DIR}/icon@2x.png"
#!/bin/bash
## CONFIG
SPLASH_SRC="src/res/screen-master.png"
SPLASH_BGD="#2b2a28"
## ANDROID
SPLASH_DIR="build/platforms/android/res"
mkdir -p $SPLASH_DIR
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 320x200 "${SPLASH_DIR}/drawable-land-ldpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 200x320 "${SPLASH_DIR}/drawable-port-ldpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 480x320 "${SPLASH_DIR}/drawable-land-mdpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 320x480 "${SPLASH_DIR}/drawable-port-mdpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 800x480 "${SPLASH_DIR}/drawable-land-hdpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 480x800 "${SPLASH_DIR}/drawable-port-hdpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 1280x720 "${SPLASH_DIR}/drawable-land-xhdpi/screen.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 720x1280 "${SPLASH_DIR}/drawable-port-xhdpi/screen.png"
## IOS
YOURAPP="XXXX"
SPLASH_DIR="build/platforms/ios/${YOURAPP}/Resources/splash"
mkdir -p $SPLASH_DIR
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 640x1136 "${SPLASH_DIR}/Default-568h@2x~iphone.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 640x960 "${SPLASH_DIR}/Default@2x~iphone.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 320x480 "${SPLASH_DIR}/Default~iphone.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 1536x2048 "${SPLASH_DIR}/Default-Portrait@2x~ipad.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 768x1024 "${SPLASH_DIR}/Default-Portrait~ipad.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 2048x1536 "${SPLASH_DIR}/Default-Landscape@2x~ipad.png"
convert $SPLASH_SRC -background $SPLASH_BGD -gravity center -extent 1024x768 "${SPLASH_DIR}/Default-Landscape~ipad.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment