Skip to content

Instantly share code, notes, and snippets.

@kubbing
Last active December 28, 2015 14:39
Show Gist options
  • Save kubbing/7515906 to your computer and use it in GitHub Desktop.
Save kubbing/7515906 to your computer and use it in GitHub Desktop.
Resize iOS icons
#!/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