Alternatives to rmagick?

Hi there,

Is there any real alternative to RMagick? I need to compose some texts
to an image, so I don’t really need anything really complex.

On 21 Oct 2009, at 14:20, Victor M. wrote:

Is there any real alternative to RMagick? I need to compose some texts
to an image, so I don’t really need anything really complex.

ImageMagick through the command line?

From http://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428:

Adding textual annotations to an image
Sometimes you need to add textual annotations to an image. For
example, imagine that your company has a standard business card image
and wants to put each employee’s details onto the card before sending
it to the printer. Another example is generating presentation
certificates for users who pass an online course on your Web site.
Let’s say you start with this image:

Figure 6. A picture from Floriade 2002

You could annotate the image with some identifying information using
the following command line:

convert -font helvetica -fill white -pointsize 36 \

-draw ‘text 10,50 “Floriade 2002, Canberra, Australia”’
floriade.jpg comment.jpg
And here is the result:

Figure 7. An annotated picture from Floriade 2002

This is by far the most complex convert command line I have shown so
far in the article, so I’ll take some time to explain it.
-font helvetica sets the annotation’s font to Helvetica. It is
possible here to specify a path to a font file as well. This example
badges the image so it can’t be reused by other Web sites without
permission, but it does so using a font that is in a non-standard
location:

convert -font fonts/1900805.ttf -fill white -pointsize 36 \

-draw ‘text 10,475 “stillhq.com”’
floriade.jpg stillhq.jpg
This is the result:

Figure 8. A badged image

-fill white fills the letters with white instead of the standard black.
-pointsize 36 specifies the size of the letters, in points. There are
72 points to an inch.
-draw ‘text 10,50 “…”’ is a set of drawing commands, in this case to
move to the position 10, 50 and then draw the text in the double
quotes. The single quotes are used because the double quotes are
needed within the drawing command if more than one word is to be
drawn, and you cannot have double quotes within double quotes.

Best regards

Peter De Berdt

Is there any real alternative to RMagick? I need to compose some texts
to an image, so I don’t really need anything really complex.

  • As someone else pointed out, ImageMagick via the command line.
  • I think GD has ruby bindings (http://www.libgd.org/Font)
  • netpbm has some stuff as well I believe…

-philip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs