Skip to content

Instantly share code, notes, and snippets.

@tjsingleton
Created July 24, 2012 05:10
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 tjsingleton/3168147 to your computer and use it in GitHub Desktop.
Save tjsingleton/3168147 to your computer and use it in GitHub Desktop.
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