Skip to content

Instantly share code, notes, and snippets.

@mmichelli
Created January 22, 2010 08:49
Show Gist options
  • Save mmichelli/283631 to your computer and use it in GitHub Desktop.
Save mmichelli/283631 to your computer and use it in GitHub Desktop.
require 'rubygems'
require "find" # to use command-line "find" to go through subdirectories for files
require 'RMagick'
@in_dir = ARGV[0]
Find.find(@in_dir) do |path|
if !FileTest.directory?(path) && (path[-4,4] == ".jpg")
puts path
puts "reading "
img = Magick::Image::read(path).first.resize_to_fit(1000,1000)
puts "writeing "
img.write(path) { self.quality = 100 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment