Skip to content

Instantly share code, notes, and snippets.

@wolfposd
Last active November 22, 2016 11:29
Show Gist options
  • Save wolfposd/7d65b9ba57e1c197100b to your computer and use it in GitHub Desktop.
Save wolfposd/7d65b9ba57e1c197100b to your computer and use it in GitHub Desktop.
Take an Image and resize for image.assets files, usage: ./resize icon.png
#!/bin/bash
f=$(pwd)
out="${f}/iconoutputfolder"
mkdir $out
sips --resampleWidth 29 "${f}/${1}" --out "${out}/Icon-29pt_at_1.png"
sips --resampleWidth 58 "${f}/${1}" --out "${out}/Icon-29pt_at_2.png"
sips --resampleWidth 87 "${f}/${1}" --out "${out}/Icon-29pt_at_3.png"
sips --resampleWidth 40 "${f}/${1}" --out "${out}/Icon-40pt_at_1.png"
sips --resampleWidth 80 "${f}/${1}" --out "${out}/Icon-40pt_at_2.png"
sips --resampleWidth 120 "${f}/${1}" --out "${out}/Icon-40pt_at_3.png"
sips --resampleWidth 60 "${f}/${1}" --out "${out}/Icon-60pt_at_1.png"
sips --resampleWidth 120 "${f}/${1}" --out "${out}/Icon-60pt_at_2.png"
sips --resampleWidth 180 "${f}/${1}" --out "${out}/Icon-60pt_at_3.png"
sips --resampleWidth 76 "${f}/${1}" --out "${out}/Icon-76pt_at_1.png"
sips --resampleWidth 152 "${f}/${1}" --out "${out}/Icon-76pt_at_2.png"
sips --resampleWidth 228 "${f}/${1}" --out "${out}/Icon-76pt_at_3.png"
sips --resampleWidth 24 "${f}/${1}" --out "${out}/Icon-24pt_at_1.png"
sips --resampleWidth 48 "${f}/${1}" --out "${out}/Icon-24pt_at_2.png"
sips --resampleWidth 27.5 "${f}/${1}" --out "${out}/Icon-27.5pt_at_1.png"
sips --resampleWidth 55 "${f}/${1}" --out "${out}/Icon-27.5pt_at_2.png"
sips --resampleWidth 44 "${f}/${1}" --out "${out}/Icon-44pt_at_1.png"
sips --resampleWidth 88 "${f}/${1}" --out "${out}/Icon-44pt_at_2.png"
sips --resampleWidth 86 "${f}/${1}" --out "${out}/Icon-86pt_at_1.png"
sips --resampleWidth 172 "${f}/${1}" --out "${out}/Icon-86pt_at_2.png"
sips --resampleWidth 98 "${f}/${1}" --out "${out}/Icon-98pt_at_1.png"
sips --resampleWidth 196 "${f}/${1}" --out "${out}/Icon-98pt_at_2.png"
sips --resampleWidth 167 "${f}/${1}" --out "${out}/Icon-83.5pt_at_2.png"
sips --resampleWidth 20 "${f}/${1}" --out "${out}/Notification-20pt_at_1.png"
sips --resampleWidth 40 "${f}/${1}" --out "${out}/Notification-20pt_at_2.png"
sips --resampleWidth 60 "${f}/${1}" --out "${out}/Notification-20pt_at_3.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment