Created
July 24, 2012 05:10
-
-
Save tjsingleton/3168147 to your computer and use it in GitHub Desktop.
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
require 'pathname' | |
ROOT = Pathname.pwd | |
SIZES = %W[ | |
1056x792 | |
1162x871 | |
1278x958 | |
1406x1054 | |
1546x1160 | |
1701x1276 | |
1871x1403 | |
2058x1543 | |
2264x1698 | |
2490x1867 | |
] | |
FILES = Dir["*.png"] | Dir["*.jpeg"] | |
FILES.each do |file_name| | |
out_dir = ROOT.join("#{file_name}-sample") | |
out_dir.mkpath unless out_dir.exist? | |
SIZES.each do |size| | |
`convert #{file_name} -resize #{size} #{out_dir.join("#{size}.png")}` | |
`convert #{file_name} -resize #{size} #{out_dir.join("#{size}.jpeg")}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment