Skip to content

Instantly share code, notes, and snippets.

@DDRBoxman
Created November 2, 2011 03:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DDRBoxman/1332737 to your computer and use it in GitHub Desktop.
Save DDRBoxman/1332737 to your computer and use it in GitHub Desktop.
Script to scale and create Android images at the correct dpi levels
#!/bin/bash
#Requires ImageMagick to be installed.
#Some builds of ImageMagick on OSX have problems generating the images correctly.
#This script scales and creates images at the correct dpi level for Android.
#It gets placed in a folder called res/drawable/source_images/ in your #Android project along with all your svg files.
#When creating svg files set the image size to the size that you want your hdpi images to be.
#To use simply run the create_images script from its folder and it will generate images for all the svg files.
for f in *.svg;
do
echo "Processing $f"
convert -background none $f ../../drawable-hdpi/${f/.svg}.png
convert -background none $f[66.67%] ../../drawable-mdpi/${f/.svg}.png
convert -background none $f[50%] ../../drawable-ldpi/${f/.svg}.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment