Page 1 of 1

Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-07-28T15:03:56-07:00
by mr fuzzy
I am trying to create outlined text and have run into trouble using Annotate(). I am running on Ubuntu 6.06 with imageMagick 6.3.4 (as reported by convert).

I have tried setting the strokewidth to a large number, I've also tried setting the weight to Bold but annotate doesn't seem to make any use of these parameters.

I have tried several other things but nothing works so far. I get the feeling that Annotate() doesn't implement several of the parameters documented at http://www.imagemagick.org/script/perl-magick.php. Is there a better source for perlmagick documentation anywhere? Any help would be gratefully recieved.

A code snipit for what I've tried:

Code: Select all

# Try writing in bold behind the normal text
$error = $image->Annotate(
	fill      => black,
	pointsize => 45,
	text      => "Test",
	weight    => Bold,     
	x         => 50,
	y         => 50,
);
print "-> $error\n";

# Try writing with a wide stroke
# for the stylish red outline
$error = $image->Annotate(
	fill        => blue,
	pointsize   => 45,
	text        => "Test",
	StrokeWidth => 5,
	Stroke      => red,
	x           => 50,
	y           => 50,
);

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-07-28T15:59:52-07:00
by magick
The ImageMagick source distribution comes with an example outline text script. Download it and take a look at ImageMagick-6.3.5/PerlMagick/demo/shadow_text.pl.

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-07-29T13:37:18-07:00
by mr fuzzy
Thanks for the tip, I had a look at the script, it was a great example of how to do an elegant drop shadow but I can't figgure out how to make it outline the text. I'm trying to get something like http://tbn0.google.com/images?q=tbn:XQx ... -title.png (image of outlined text "Mozilla").

Again, any help appreciated

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-07-29T13:50:45-07:00
by magick
Next up take a look at this tutorial: http://www.imagemagick.org/Usage/fonts/.

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-07-30T07:25:56-07:00
by mr fuzzy
Thanks for the directions, I've got it working now.

The problem was related to my setup. I didn't have FreeType installed properly.

For anyone else with a related problem, this is how I fixed it:

The hint was when I ran one of the annotate demos from the tutorial page I got the error:
convert: unable to read font `Garuda'.
convert: FreeType library is not available ........

I followed the instuctions from the post viewtopic.php?f=1&t=7177 subject: "Freetype missing ..." and installed freetype then recompiled ImageMagick.

I also had to replace the file:
/usr/local/lib/ImageMagick-6.3.4/config/type-ghostscript.xml

Which was pointing at the wrong place, with the file:
/usr/lib/ImageMagick-6.2.4/config/type-ghostscript.xml

After that everything started working perfectly, including the -stroke parameter.

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2007-10-03T03:34:52-07:00
by anthony
rather than constantaly replacing the system file, you can create a personal 'type.xml' file in a '.magick' sub-directory of your home. See the top level page of IM Examples http://www.imagemagick.org/Usage/#fonts for one automated method of generating this file for your system.

Re: Drawing outlined text with Annotate: Parameter trouble

Posted: 2011-07-02T04:58:03-07:00
by karenchu
hm, useful tip. never heard of such a way