Skip to content

Instantly share code, notes, and snippets.

@venj
Created May 21, 2012 05:38
Show Gist options
  • Save venj/2760670 to your computer and use it in GitHub Desktop.
Save venj/2760670 to your computer and use it in GitHub Desktop.
batch convert images for appstore for my project.
#!/usr/bin/env ruby
require "fileutils"
include FileUtils
p = "processed"
mkdir "processed" unless File.exists?(p)
Dir["*.png"].each do |f|
puts "Processing #{f}."
name = File.basename(f).split('.')[0]
cp f, "#{p}/#{name}@2x.png"
system("convert -resize 96x96 #{f} #{p}/#{name}[email protected]")
system("convert -resize 64x64 #{f} #{p}/#{name}.png")
system("convert -resize 48x48 #{f} #{p}/#{name}_small.png")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment