Skip to content

Instantly share code, notes, and snippets.

@mmilidoni
Last active May 20, 2017 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmilidoni/6cb3397a2c93f8b41ec06c3dacea38f4 to your computer and use it in GitHub Desktop.
Save mmilidoni/6cb3397a2c93f8b41ec06c3dacea38f4 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# https://github.com/phonegap/phonegap/wiki/App-Splash-Screen-Sizes
splashesAndroid = [
{"resize": 320, "crop": "200x320", "fileout": "drawable-port-ldpi-screen"},
{"resize": 320, "crop": "320x200", "fileout": "drawable-land-ldpi-screen"},
{"resize": 480, "crop": "320x480", "fileout": "drawable-port-mdpi-screen"},
{"resize": 480, "crop": "480x320", "fileout": "drawable-land-mdpi-screen"},
{"resize": 800, "crop": "480x800", "fileout": "drawable-port-hdpi-screen"},
{"resize": 800, "crop": "800x480", "fileout": "drawable-land-hdpi-screen"},
{"resize": 1280, "crop": "720x1280", "fileout": "drawable-port-xhdpi-screen"},
{"resize": 1280, "crop": "1280x720", "fileout": "drawable-land-xhdpi-screen"},
{"resize": 1600, "crop": "960x1600", "fileout": "drawable-port-xxhdpi-screen"},
{"resize": 1600, "crop": "1600x960", "fileout": "drawable-land-xxhdpi-screen"},
{"resize": 1920, "crop": "1280x1920", "fileout": "drawable-port-xxxhdpi-screen"},
{"resize": 1920, "crop": "1920x1280", "fileout": "drawable-land-xxxhdpi-screen"},
]
from subprocess import call
for splash in splashesAndroid:
call("convert -resize " + str(splash["resize"]) + " -crop " + splash["crop"] + "+0+0 -gravity center start.png " + splash["fileout"] + ".png", shell="True")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment