Last active
December 28, 2015 14:39
-
-
Save kubbing/7515906 to your computer and use it in GitHub Desktop.
Resize iOS icons
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
#!/usr/bin/env ruby | |
if not ARGV[0] | |
puts "usage: ./script <icon.png>" | |
return | |
end | |
$icon = ARGV[0] | |
iPhone_dimensions = [ 29, 40, 57, 60 ] | |
iPad_dimensions = [ 29, 40, 50, 72, 76 ] | |
def command (size, retina) | |
if retina | |
"convert #{$icon} -resize #{2*size}x#{2*size} out-#{size}@2x.png\n" | |
else | |
"convert #{$icon} -resize #{size}x#{size} out-#{size}.png\n" | |
end | |
end | |
command = "" | |
iPhone_dimensions.each do |size| | |
command << command(size, false) | |
command << command(size, true) | |
end | |
iPad_dimensions.each do |size| | |
command << command(size, false) | |
command << command(size, true) | |
end | |
exec command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment