def ObfuscatedImage.create( key, font, font_size, x_spacing, max_wiggle_y, rotation )
width, height = 0, 0
key.each_byte do |byte|
char = byte.chr
err, bounds = GD::Image.stringFT( 0, font, font_size, 0, 0, 0, char )
raise err if err
bounds = Rectangle.from_array( bounds )
width += bounds.width
height = bounds.height if height < bounds.height
end
char_height = height
extra_x = x_spacing * ( key.length + 1 )
extra_y = max_wiggle_y
width += extra_x
height += extra_y
image = new( width, height )
image.initialize_image( key, font, font_size, x_spacing, max_wiggle_y, char_height, rotation )
return image
end