Created
November 2, 2011 03:05
-
-
Save DDRBoxman/1332737 to your computer and use it in GitHub Desktop.
Script to scale and create Android images at the correct dpi levels
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
#!/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