From: Tim Hunter Date: 2006-03-19T08:38:48+09:00 Subject: Re: text to images using RMagick Ray wrote: > Hi Tim, thanks for your quick response. I'm very new to this, Im on Mac > OSX 10.4.5, how do I check the version of ImageMagick installed? > > Also, when I do get it working, can all text formatting (eg: bold, > italic, colours, etc) work with the caption parameter? > > Ta, Ray > Enter this command in irb: irb -r RMagick puts Magick::Long_version The doc on the "caption" builtin format[1] says that you can use these options with caption: antialias background_color border_color density fill font gravity pointsize font_style and font_weight aren't on the list, so you can't specify italic or bold with caption. You could specify a bold or italic font by name instead. (This is a limitation of ImageMagick, not RMagick.) To specify those kinds of attributes you're going to have to use the Draw#text method[2] or RVG::Text[3] or the Draw#annotate method[4]. The annotate method will handle strings with embedded newlines, the other two don't. Keep in mind that ImageMagick will not alter a font (the way Windows slants a font to fake italics, for example) to match the attributes you specify. It simply searches its list of fonts (which may not include all the fonts you have on your system) to find the closest match and uses that. If you ask for a bold Arial and it doesn't have Arial Bold on its list, it'll just give you Arial. If you absolutely need a certain font, the best thing to do is to specify the full path to the font. Anthony Thyssen has a great set of ImageMagick examples, including one about fonts[5]. The examples use the ImageMagick commands but it's not hard to map them into the RMagick API. (If you do need help translating the commands into RMagick send me an email and I'll see what I can do.) [1]http://www.simplesystems.org/RMagick/doc/imusage.html#builtin_formats [2]http://www.simplesystems.org/RMagick/doc/draw.html#text [3]http://www.simplesystems.org/RMagick/doc/rvgtext.html [4]http://www.simplesystems.org/RMagick/doc/draw.html#annotate [5]http://www.cit.gu.edu.au/~anthony/graphics/imagick6/text/