Created
May 21, 2013 12:52
-
-
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
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
# 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