Created
September 24, 2014 06:03
-
-
Save baio/f77d4da4f431546acb4f to your computer and use it in GitHub Desktop.
gen-icon.sh (gen-con.bat) | run `gen-icon src.jpg[png] black` | run `gen-screen src.jpg[png] black` | imagemagic must be installed (choco install imagemagic - for windows) | cordova 3.6.3-0.2.13, ionic 1.1.9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate PhoneGap icon and splash screens. | |
# Copyright 2013 Tom Vincent <http://tlvince.com/contact> | |
usage() { echo "usage: $0 icon colour [dest_dir]"; exit 1; } | |
[ "$1" ] && [ "$2" ] || usage | |
[ "$3" ] || set "$1" "$2" "." | |
devices=android,bada,bada-wac,blackberry,ios,webos,windows-phone | |
eval mkdir -p "$3/{icon,screen}" | |
# Show the user some progress by outputing all commands being run. | |
set -x | |
# Explicitly set background in case image is transparent (see: #3) | |
convert="convert -background none" | |
$convert "$1" -resize 36x36 "$3/icon/36.png" | |
$convert "$1" -resize 48x48 "$3/icon/48.png" | |
$convert "$1" -resize 62x62 "$3/icon/62.png" | |
$convert "$1" -resize 72x72 "$3/icon/72.png" | |
$convert "$1" -resize 96x96 "$3/icon/96.png" | |
$convert "$1" -resize 173x173 "$3/icon/173.png" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate PhoneGap icon and splash screens. | |
# Copyright 2013 Tom Vincent <http://tlvince.com/contact> | |
usage() { echo "usage: $0 icon colour [dest_dir]"; exit 1; } | |
[ "$1" ] && [ "$2" ] || usage | |
[ "$3" ] || set "$1" "$2" "." | |
devices=android,bada,bada-wac,blackberry,ios,webos,windows-phone | |
eval mkdir -p "$3/{icon,screen}" | |
# Show the user some progress by outputing all commands being run. | |
set -x | |
# Explicitly set background in case image is transparent (see: #3) | |
convert="convert $1 -background $2 -gravity center" | |
$convert -resize 200x320 "$3/screen/200x320.png" | |
$convert -resize 225x225 "$3/screen/225x225.png" | |
$convert -resize 240x400 "$3/screen/240x400.png" | |
$convert -resize 320x200 "$3/screen/320x200.png" | |
$convert -resize 320x480 "$3/screen/320x480.png" | |
$convert -resize 480x320 "$3/screen/480x320.png" | |
$convert -resize 480x800 "$3/screen/480x800.png" | |
$convert -resize 480x800 "$3/screen/480x800.jpg" | |
$convert -resize 640x960 "$3/screen/649x960.png" | |
$convert -resize 720x1280 "$3/screen/720x1280.png" | |
$convert -resize 768x1004 "$3/screen/768x1004.png" | |
$convert -resize 800x480 "$3/screen/800x480.png" | |
$convert -resize 960x640 "$3/screen/960x640.png" | |
$convert -resize 1280x720 "$3/screen/1280x720.png" | |
$convert -resize 1024x783 "$3/screen/1024x783.png" | |
$convert -resize 1536x2008 "$3/screen/1536x2008.png" | |
$convert -resize 2008x1536 "$3/screen/2008x1536.png" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// | |
// This hook copies various resource files | |
// from our version control system directories | |
// into the appropriate platform specific location | |
// | |
// configure all the files to copy. | |
// Key of object is the source file, | |
// value is the destination location. | |
// It's fine to put all platforms' icons | |
// and splash screen files here, even if | |
// we don't build for all platforms | |
// on each developer's box. | |
var filestocopy = [ | |
//wp 8 | |
{ | |
"res/screen/480x800.jpg": | |
"platforms/wp8/SplashScreenImage.jpg" | |
}, | |
{ | |
"res/icon/173.png": | |
"platforms/wp8/Background.png" | |
}, | |
{ | |
"res/icon/62.png": | |
"platforms/wp8/ApplicationIcon.png" | |
}, | |
//android | |
{ | |
"res/icon/96.png": | |
"platforms/android/res/drawable/icon.png" | |
}, | |
{ | |
"res/icon/72.png": | |
"platforms/android/res/drawable-hdpi/icon.png" | |
}, | |
{ | |
"res/screen/800x480.png": | |
"platforms/android/res/drawable-land-hdpi/screen.png" | |
}, | |
{ | |
"res/screen/320x200.png": | |
"platforms/android/res/drawable-land-ldpi/screen.png" | |
}, | |
{ | |
"res/screen/480x320.png": | |
"platforms/android/res/drawable-land-mdpi/screen.png" | |
}, | |
{ | |
"res/screen/1280x720.png": | |
"platforms/android/res/drawable-land-xhdpi/screen.png" | |
}, | |
{ | |
"res/icon/36.png": | |
"platforms/android/res/drawable-ldpi/icon.png" | |
}, | |
{ | |
"res/icon/48.png": | |
"platforms/android/res/drawable-mdpi/icon.png" | |
}, | |
{ | |
"res/screen/480x800.png": | |
"platforms/android/res/drawable-port-hdpi/screen.png" | |
}, | |
{ | |
"res/screen/200x320.png": | |
"platforms/android/res/drawable-port-ldpi/screen.png" | |
}, | |
{ | |
"res/screen/320x480.png": | |
"platforms/android/res/drawable-port-mdpi/screen.png" | |
}, | |
{ | |
"res/screen/720x1280.png": | |
"platforms/android/res/drawable-port-xhdpi/screen.png" | |
}, | |
{ | |
"res/icon/96.png": | |
"platforms/android/res/drawable-xhdpi/icon.png" | |
} | |
]; | |
var fs = require('fs'); | |
var path = require('path'); | |
// no need to configure below | |
var rootdir = process.argv[2]; | |
filestocopy.forEach(function(obj) { | |
Object.keys(obj).forEach(function(key) { | |
var val = obj[key]; | |
var srcfile = path.join(rootdir, key); | |
var destfile = path.join(rootdir, val); | |
//console.log("copying "+srcfile+" to "+destfile); | |
var destdir = path.dirname(destfile); | |
if (fs.existsSync(srcfile) && fs.existsSync(destdir)) { | |
fs.createReadStream(srcfile).pipe( | |
fs.createWriteStream(destfile)); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment