Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Gyoung-Yoon Noh

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Resizing images using RMagick

require 'rubygems'
require 'RMagick'

include Magick

def append_filename(filename, suffix)
  extrac = filename.split('.')
  extrac[-2] += suffix
  extrac.join('.')
end                                                                                  
ARGV.each do |f|
  ImageList.new(f).resize(800, 600).write(append_filename(f, '_l'))
  ImageList.new(f).resize(400, 300).write(append_filename(f, '_m'))
  ImageList.new(f).resize(40, 30).write(append_filename(f, '_s'))
end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS