Skip to content

Instantly share code, notes, and snippets.

@eveevans
Created November 16, 2011 23:26
Show Gist options
  • Save eveevans/1371854 to your computer and use it in GitHub Desktop.
Save eveevans/1371854 to your computer and use it in GitHub Desktop.
Generacion de Miniaturas usando Ruby e Image Magick
# 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