Created
November 16, 2011 23:26
-
-
Save eveevans/1371854 to your computer and use it in GitHub Desktop.
Generacion de Miniaturas usando Ruby e Image Magick
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
# Ruby, Generacion de minuaturas usando Image Magick | |
i = 0 | |
full = "1200x900" | |
thumb = "320x240" | |
images = Dir.entries(".") | |
images.each do |file| | |
if file.match(/\.jpg$/i) | |
i+=1 | |
puts "[#{i}] Procesando #{file}..." | |
puts "Creando full ..." | |
system " convert \"#{file}\" -resize \"#{full}\" -quality 90 \"#{i}_full.jpg\" " | |
puts "Creando Miniatura ..." | |
system " convert \"#{file}\" -resize \"#{thumb}\" -quality 90 \"#{i}_thumb.jpg\" " | |
puts "Renombrando" | |
File.rename(file,"#{i}_original.jpg") | |
end | |
end | |
puts "=====Proceso finalizado, procesadas #{i} imagenes=====" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment