Skip to content

Instantly share code, notes, and snippets.

@VincentSit
Forked from rnystrom/iOS @3x assets script
Created May 11, 2019 03:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VincentSit/b76dcfce084e030a68556a6f9c18cb87 to your computer and use it in GitHub Desktop.
Save VincentSit/b76dcfce084e030a68556a6f9c18cb87 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