RMagick生成不了验证码

我在测试一个登陆的例子,但在我的机子上验证码显示不出来,只留下一个叉
def initialize(len)
chars = ('a'..'z').to_a - ['a','e','i','o','u']
code_array=[]
1.upto(len) {code_array << chars[rand(chars.length)]}
granite = Magick::ImageList.new('xc:#ffffff')
canvas.new_image(32*len, 50, Magick::TextureFill.new(granite))
text = Magick::Draw.new
text.font_family = 'times'
text.pointsize = 40
cur = 10
code_array.each{|c|
rand(10) > 5 ? rot=rand(Wobble):rot= -rand(Wobble)
rand(10) > 5 ? weight = NormalWeight : weight = BoldWeight
text.annotate(canvas,0,0,cur,30+rand(Jiggle),c){
self.rotation=rot
self.font_weight = weight
self.fill = 'gray'
}
cur += 30
}
@code = code_array.to_s
@code_image = canvas.to_blob{
self.format="JPG"
}
end
不知哪里出了问题,程序到granite = Magick::ImageList.new('xc:#ffffff')这步就不能运行了,但不报错,验证码图片位置只显示了一个叉
请问有谁知道哪里出错了,不吝赐教!
谢谢各位了!

你可能感兴趣的:(C++,c,C#)