Skip to content

Instantly share code, notes, and snippets.

@keroxp
Created May 21, 2013 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keroxp/5619554 to your computer and use it in GitHub Desktop.
Save keroxp/5619554 to your computer and use it in GitHub Desktop.
フォルダ中の@2x画像をすべて縮小して非retina用画像にするスクリプト tiny script for resizing all reitna images in specified directory into non-retina images #USAGE ruby iosimgresize.rb DIR_NAME
# coding:utf-8
require "rubygems"
require "RMagick"
if !ARGV[0]
STDERR.puts "missing argument"
exit
end
if ARGV.length > 1
STDERR.puts "too many arguments"
exit
end
Dir.chdir ARGV[0]
Dir.glob("*@2x.(png|jpeg|gif)") { |file|
img = Magick::ImageList.new file
w = img.columns
h = img.rows
img.resize(w/2,h/2).write(file.gsub("@2x",""))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment