Rails / Ruby - What gem can create a image with text?
ruby, ruby-on-rails, ruby-on-rails-3
Solution
A basic rmagick solution isn't that bad, 6 lines. The following gives you a yellow rectangle with TEXT in the center. You can experiment with the font and point size. The center call is there because I thought it looked better in the middle.
require 'RMagick'
canvas = Magick::Image.new(300, 100){self.background_color = 'yellow'}
gc = Magick::Draw.new
gc.pointsize(50)
gc.text(30,70, "TEXT".center(14))
gc.draw(canvas)
canvas.write('tst.png')
I get the requirement, you can also go through. This should help.
Problem
Example I have a image. In my controller I example have `@name = "Jon"` Now I want to create a new image as the image I got just with the name "Jon" in the middle of the image. I want to be able to specify the font-size, color and font-family that should be used and the position of the text. What gem are able to do that?