Created
July 29, 2013 02:26
-
-
Save henteko/6101815 to your computer and use it in GitHub Desktop.
Androidの各種サイズのリソースを生成してくれるやつ
同じディレクトリに*.pngがあるとそれを全部変換して適切なディレクトリに入れてくれる
$ ruby android_icon_generate.rb
This file contains hidden or 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
array = [48, 72, 96, 144] | |
dirs = ["drawable-mdpi", "drawable-hdpi", "drawable-xhdpi", "drawable-xxhdpi"] | |
dirs.each do |dir| | |
system("mkdir #{dir}") | |
end | |
Dir::glob("*.png").each do |file| | |
array.each_with_index do |size, i| | |
dir = dirs[i] | |
command = "sips -z #{size} #{size} #{file} --out #{dir}/#{file}" | |
system(command) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment