Created
November 15, 2011 09:44
-
-
Save satococoa/1366584 to your computer and use it in GitHub Desktop.
sipsで画像のコピー&リサイズ。@2x.png
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
| require 'pp' | |
| require 'pathname' | |
| resize_command = 'sips -z 34 34 --out out/%2$s %1$s' | |
| copy_command = 'cp %s out/%s' | |
| Pathname.glob('./*').sort.each_with_index do |path, idx| | |
| next unless path.to_s.match(/png$/) | |
| system(copy_command % [path.to_s, idx.to_s+'@2x.png']) | |
| system(resize_command % [path.to_s, idx.to_s+'.png']) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment