Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text to images using RMagick

883 views
Skip to first unread message

Nick Hayworth

unread,
Jun 9, 2005, 3:30:47 PM6/9/05
to
Hi all

just wondering if it's possible to convert a string to an image x pixels
wide. The text should automatically wrap at x pixels. i can do this using
ImageMagick's convert utility :

convert -size 200x -font Tahoma -pointsize 20 caption:"My very long caption
which should wrap at 200 pixels" output.gif

I looked at the annotate method in RMagick but it looks like I need to
specify the image dimensions. Can anyone suggest how I might get the effect
I want using RMagick?


Timothy Hunter

unread,
Jun 9, 2005, 9:25:13 PM6/9/05
to

I got this to work but while doing so I discovered that RMagick is
missing an attribute in the Image::Info class. I'll upload a new version
tomorrow and post an announcement here.

Timothy Hunter

unread,
Jun 10, 2005, 7:27:38 PM6/10/05
to
Okay, I just uploaded a new version of RMagick, version 1.8.2. With this
version you can use this script:

require 'RMagick'
include Magick

img = Image.read("caption:My very long caption which should wrap at 200
pixels") do
self.size = "200x"
self.pointsize = 20
self.font = "Tahoma"
end

img[0].display

Nick Hayworth

unread,
Jun 12, 2005, 2:27:49 AM6/12/05
to
"Timothy Hunter" <cycl...@nc.rr.com> wrote in message
news:Klpqe.1304$1u3....@twister.southeast.rr.com...

> Okay, I just uploaded a new version of RMagick, version 1.8.2. With this
> version you can use this script:
>
> require 'RMagick'
> include Magick
>
> img = Image.read("caption:My very long caption which should wrap at 200
> pixels") do
> self.size = "200x"
> self.pointsize = 20
> self.font = "Tahoma"
> end
>
> img[0].display

that's excellent! Thanks for taking the time to do this and for writing such
a great library.

nick


0 new messages