[导入]Avatar Resizer

Posted on 2007-12-07 17:32 Evily.Win 阅读(12) 评论(0)  编辑 收藏 网摘
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


#!/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

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
Google站内搜索

相关文章:

相关链接:


 

posts - 56, comments - 1, trackbacks - 0, articles - 2

Copyright © Evily.Win