All pastes #166788 Raw Edit

Someone

public ruby v1 · immutable
·published 2006-09-11 09:47 UTC
rendered paste body
#!/usr/bin/ruby -wrequire 'RMagick'include Magickinclude FileTestsize_h = 150size_w = 300class Image	def quick_thumb( m_w, m_h)		w, h = [self.columns, self.rows]		n_w, n_h = if w <= h  							[m_w, m_w*h/w]					  else 							[w/h*m_h, m_h]					  end		self.thumbnail( n_w, n_h )	endendfile = ARGV[0]file = Dir[ARGV[0]+"/*"] if FileTest.directory?(ARGV[0])file.each do |f| 	img = ImageList.new( f )	img.quick_thumb( size_w, size_h ).write( "thumb_"+f )end# __END__