Skip to content

Instantly share code, notes, and snippets.

@henteko
Created July 29, 2013 02:26
Show Gist options
  • Save henteko/6101815 to your computer and use it in GitHub Desktop.
Save henteko/6101815 to your computer and use it in GitHub Desktop.
Androidの各種サイズのリソースを生成してくれるやつ 同じディレクトリに*.pngがあるとそれを全部変換して適切なディレクトリに入れてくれる $ ruby android_icon_generate.rb
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