OSDN Git Service

- add tag function to newentry and editentry.
[feedblog/feedgenerator.git] / resize.rb
1 #!/usr/local/bin/ruby 
2 # -*- coding: utf-8 -*-
3
4 THUMBS_SIZE = 150
5
6 class ResizeManager
7   def self.create_thumbs(fname)
8     $LOAD_PATH.push("/home/lunardial/local/lib")
9     $LOAD_PATH.push("/home/lunardial/local/lib/ruby/gem/gems/rmagick-2.13.1/lib")
10     
11     require 'rubygems' 
12     require 'RMagick'
13     
14     img = Magick::Image.read(fname).first
15     
16     img.resize_to_fit!(THUMBS_SIZE, THUMBS_SIZE)
17     thumbs_name = fname.gsub(/#{File.extname(fname)}\Z/, "") + "_thumbs" + File.extname(fname)
18     img.write(thumbs_name)
19   end
20 end