[导入]Avatar Resizer
I go on a lot of Bulletin Board, every has its own limits of size for the avatars, instead of the resize manually I created a script which does it for me with RMagick
文章来源:http://snippets.dzone.com/posts/show/3860
#!/usr/bin/ruby
require "RMagick"
$SIZES = [80 , 100 , 110 , 128]
if !ARGV[0]
puts "Usage: mk_avatars.rb SourceAvatarPath"
exit
end
image = Magick::Image.read(ARGV[0]).first
$SIZES.each do |sz|
puts "Generating Avatar : #{sz}"
out = image.thumbnail(sz,sz)
file = "out_#{sz}.#{image.format}"
out.write(file)
end
文章来源:http://snippets.dzone.com/posts/show/3860
浙公网安备 33010602011771号