Script to create Android Application Icons

On Linux/Ubuntu, run below script as,

$ image.png



#argument image should be with png format

#cleanup previous icons
ICON_NAME=$1 #take icon name as first argument

echo “Creating android icons of different dimensions for $ICON_NAME”

mkdir -p $DIR_TO_SAVE_ICONS/drawable-xxxhdpi/
mkdir -p $DIR_TO_SAVE_ICONS/drawable-xxhdpi/
mkdir -p $DIR_TO_SAVE_ICONS/drawable-xhdpi/
mkdir -p $DIR_TO_SAVE_ICONS/drawable-hdpi/
mkdir -p $DIR_TO_SAVE_ICONS/drawable-mdpi/
mkdir -p $DIR_TO_SAVE_ICONS/drawable-ldpi/

convert $ICON_NAME -resize 192×192 $DIR_TO_SAVE_ICONS/drawable-xxxhdpi/$ICON_NAME
convert $ICON_NAME -resize 144×144 $DIR_TO_SAVE_ICONS/drawable-xxhdpi/$ICON_NAME
convert $ICON_NAME -resize 96×96 $DIR_TO_SAVE_ICONS/drawable-xhdpi/$ICON_NAME
convert $ICON_NAME -resize 72×72 $DIR_TO_SAVE_ICONS/drawable-hdpi/$ICON_NAME
convert $ICON_NAME -resize 48×48 $DIR_TO_SAVE_ICONS/drawable-mdpi/$ICON_NAME
convert $ICON_NAME -resize 36×36 $DIR_TO_SAVE_ICONS/drawable-ldpi/$ICON_NAME

READ  What is the difference between setup_irq and request_irq in Linux kernel interrupts ?

#create a zip to copy to android app, res folder

zip -r $ .

echo “Icon zip $ is ready at $DIR_TO_SAVE_ICONS”


Extract above generated .zip inside res folder of application source

Leave a Reply

Your email address will not be published. Required fields are marked *