I recently took over someone else's position on a project. When the below code was run on their old machine, it worked fine. But when I run it, I get a blank white line with a yellow rectangle with a red outline. Essentially, the Draw() method works fine, but the Annotate() method isn't doing anything. No matter what values I pass it for text, font, fontsize, or color, no text will show up.
Here's the relevant code:
my ($length,$width,$boxRef,$text,$font,$fontSize,$fontColor,$outFile) = @_;
my $image = Image::Magick->new;
$image->Set(size=>$length."x".$width);
$image->ReadImage('xc:white');
$image->Draw(primitive=>'rectangle',stroke=>'red',fill=>'yellow',points=>"$$boxRef[0],$$boxRef[1],$$boxRef[2],$$boxRef[3]");
my $y = $image->Annotate(text=>$text,font=>$font,fill=>$fontColor,pointsize=>$fontSize,geometry=>'+0+20');
warn "$y" if "$y";
my $x = $image->Write($outFile);
warn "$x" if "$x";
undef $image;
I'm pretty sure nothing is wrong with the code, as other simpler scripts won't work either. I believe there is something wrong with my machine or installation of ImageMagick, but I have no idea what is wrong.
My boss said that he remembers the previous person struggling with some font issue, so maybe that has something to do with it? I've been doing some digging the past day or so, but I haven't found anything that seems to be quite like my problem that offers a good solution.
Does anyone know why I can't get ImageMagick to display text?
Some information about my setup:
OS X Mavericks 10.9.3; ImageMagick 6.8.9-1 / PerlMagick 6.88 (installed thru Homebrew)