Created
July 2, 2012 10:29
-
-
Save sophistifunk/3032530 to your computer and use it in GitHub Desktop.
Create a bunch of resized icons for iOS projects
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/ruby | |
# Takes one large image (say, 512 or 1024 px) and creates some iOS icons: | |
# | |
# Icon-72.png | |
# Icon-Small-50.png | |
# Icon-Small.png | |
# [email protected] | |
# Icon.png | |
# [email protected] | |
require 'rubygems' | |
require 'image_science' | |
unless ARGV.length == 1 | |
print "usage: make-ios-icons.rb big-ass-image.png\n" | |
exit | |
end | |
names = %w{Icon-72.png [email protected] Icon-Small-50.png Icon-Small.png [email protected] Icon.png [email protected]} | |
sizes = [72, 144, 50, 29, 58, 57, 114] | |
ImageScience.with_image(ARGV[0]) do |img| | |
sizes.zip(names).each do |size_name| | |
img.resize(size_name[0], size_name[0]) do |img2| | |
img2.save size_name[1] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment