Created
March 29, 2015 19:13
-
-
Save wreiske/a9d2706491a073b293de to your computer and use it in GitHub Desktop.
Creates all the needed icons for Android and iOS + mobile-config.js for Meteor
This file contains 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
import os | |
from progressbar import ProgressBar, Percentage, Bar, ETA | |
print "----------------- Icon Generator ------------------" | |
print "Usage: icon-generator.py" | |
print "See files_ios { } in icon-generator.py" | |
print "icon-ios.png and icon-android.png" | |
print "---------------------------------------------------" | |
input_ios = './icon-ios.png' | |
input_android = './icon-android.png' | |
files_ios = { | |
'./resources/icons/icon-60x60.png':'60x60', | |
'./resources/icons/[email protected]':'120x120', | |
'./resources/icons/[email protected]':'180x180', | |
'./resources/icons/icon-72x72.png':'72x72', | |
'./resources/icons/[email protected]':'144x144', | |
'./resources/icons/icon-76x76.png':'76x76', | |
'./resources/icons/[email protected]':'152x152', | |
'./resources/icons/icon-36x36.png':'36x36', | |
'./resources/icons/icon-48x48.png':'48x48', | |
'./resources/icons/icon-96x96.png':'96x96', | |
'./resources/icons/icon-144x144.png':'144x144', | |
'./resources/icons/icon-192x192.png':'192x192' | |
} | |
files_android = { | |
'./resources/icons/icon-72x72-android.png':'72x72', | |
'./resources/icons/icon-36x36-android.png':'36x36', | |
'./resources/icons/icon-48x48-android.png':'48x48', | |
'./resources/icons/icon-96x96-android.png':'96x96' | |
} | |
file_count = len(files_ios) | |
pbar = ProgressBar(widgets=[Percentage(),' ', ETA(), ' ', Bar()], maxval=file_count) | |
print "Total Images to Convert = %s" % (file_count+1) | |
for f,s in pbar(files_ios.items()): | |
os.system("rm -f " + f) | |
os.system("convert " + input_ios + " -resize " + s + " " + f) | |
file_count = len(files_android) | |
pbar = ProgressBar(widgets=[Percentage(),' ', ETA(), ' ', Bar()], maxval=file_count) | |
print "Total Images to Convert = %s" % (file_count+1) | |
for f,s in pbar(files_android.items()): | |
os.system("rm -f " + f) | |
os.system("convert " + input_android + " -resize " + s + " " + f) |
This file contains 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
App.icons({ | |
// iOS | |
'iphone': 'resources/icons/icon-60x60.png', | |
'iphone_2x': 'resources/icons/[email protected]', | |
'iphone_3x': 'resources/icons/[email protected]', | |
'ipad': 'resources/icons/icon-76x76.png', | |
'ipad_2x': 'resources/icons/[email protected]', | |
// Android | |
'android_ldpi': 'resources/icons/icon-36x36-android.png', | |
'android_mdpi': 'resources/icons/icon-48x48-android.png', | |
'android_hdpi': 'resources/icons/icon-72x72-android.png', | |
'android_xhdpi': 'resources/icons/icon-96x96-android.png' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: You need to make sure that the directories exist.