Skip to content

Instantly share code, notes, and snippets.

@badgercl
Created April 1, 2015 17:32
Show Gist options
  • Select an option

  • Save badgercl/63847551595431586f19 to your computer and use it in GitHub Desktop.

Select an option

Save badgercl/63847551595431586f19 to your computer and use it in GitHub Desktop.
Script to create Android App icon assets
#!/bin/bash
#LDPI should be 36 x 36.
#MDPI should be 48 x 48.
#TVDPI should be 64 x 64.
#HDPI should be 72 x 72.
#XHDPI should be 96 x 96.
#XXHDPI should be 144 x 144.
#XXXHDPI should be 192 x 192.
## format_names and formats MUST have the same length
format_names=("ldpi" "mdpi" "tvdpi" "hdpi" "xhdpi" "xxhdpi" "xxxhdpi")
formats=(36 48 64 72 96 144 192)
total=${#formats[*]}
for ((i=0; i<=$((total-1)); i++))
do
mkdir drawable-${format_names[$i]}
cp base.png ./drawable-${format_names[$i]}/ic_launcher.png
sips -Z ${formats[$i]} ./drawable-${format_names[$i]}/ic_launcher.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment