Skip to content

Instantly share code, notes, and snippets.

@rnystrom
Created November 26, 2014 01:52
Show Gist options
  • Save rnystrom/25f272aa9d94ceaec401 to your computer and use it in GitHub Desktop.
Save rnystrom/25f272aa9d94ceaec401 to your computer and use it in GitHub Desktop.
Save this shell script to generate @2x and 1x PNG assets for your apps. Requires Imagemagick (http://www.imagemagick.org/). These will probably look shitty and blurred.
#!/bin/sh
# Example usage
# cd into directory that has @3x images
# ./whatever-you-name-this.sh
# Remember to chmod +x the script
resize () {
ls *@3x.png | awk '{print("convert "$1" -filter box -resize '$1' "$1)}' | sed 's/@3x/'$2'/2' | /bin/sh
}
resize 66.67% @2x
resize 33.33%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment