Skip to content

Instantly share code, notes, and snippets.

@3zcurdia
Last active August 29, 2015 13:57
Show Gist options
  • Save 3zcurdia/9380776 to your computer and use it in GitHub Desktop.
Save 3zcurdia/9380776 to your computer and use it in GitHub Desktop.
script to automate the sprite image generation using image magick and pngcrush
mkdir revised;
for file in *.png; do
filename=${file%.*}
ext=${file#*.}
mogrify -resize 128x128 -density 72 -units PixelsPerInch -write revised/$filename.128.$ext $file;
mogrify -resize 64x64 -density 72 -units PixelsPerInch -write revised/$filename.64.$ext $file;
mogrify -resize 32x32 -density 72 -units PixelsPerInch -write revised/$filename.32.$ext $file;
done
montage revised/*.png -geometry +2+2 -background 'rgba(0,0,0,0)' sprites.png
pngcrush sprites.png sprites-optimized.png;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment