Last Updated: February 25, 2016
·
1.539K
· yuyak

Automatically Create Icons for iOS Apps

As iOS apps require several sizes of icon, I wrote a rake task to achieve it automatically.

How To Use

Put this Rakefile.rb.

# coding: utf-8

desc 'Create icons'
  task :create_icons do

  # Source icon filename
  input = 'Icon-1024.png'
  output_dir_path = 'Images/'

  [
    { name: 'Icon-72.png', size: 72 },
    { name: 'Icon-72@2x.png', size: 144 },
    { name: 'Icon-Small-50.png', size: 50 },
    { name: 'Icon-Small.png', size: 29 },
    { name: 'Icon-Small@2x.png', size: 58 },
    { name: 'Icon.png', size: 57 },
    { name: 'Icon@2x.png', size: 114 },
  ].each do |v|
    output = output_dir_path + v[:name]
    command = "convert -resize #{v[:size]} #{input} #{output}"
    puts command
    system command
  end
end

And then, run following command.

% rake create_icons

Note: Since ImgeMagic is used In the command, you may need to install it if you don't have it in your system.

% brew install imagemagick

4 Responses
Add your response

Neat, thanks!

over 1 year ago ·

Great tip, thanks a lot! I created a gist of it, if you don't mind. I gave you full credit in the description obviously :-)

https://gist.github.com/AzizLight/6001881

over 1 year ago ·

@AzizLight

It's great! Thanks.

over 1 year ago ·

Or just use a set of placeholder images like this?
https://github.com/FattusMannus/iOS-Development-Image-Placeholders

over 1 year ago ·