Hi All,
Having a devil of a time with this one.
I am trying to add a line of text to a JPEG image using Image::Magick. Where I am coming unstuck is that I want to use the copyright symbol. The following almost works:
#!/usr/local/bin/perl
use strict;
use warnings;
use Image::Magick;
my($image, $x);
$image = Image::Magick->new;
$x=$image->Read('SV000360.JPG');
warn "$x" if "$x";
my($xSize, $ySize) = $image->Get('width', 'height');
print "Width: $xSize\t Height: $ySize\n";
my $text = chr(hex (0xa9));
$text.="© Some person.";
my $yPos=$ySize-50;
print "Text:$text\n";
$x=$image->Annotate(font=>"/usr/share/fonts/msttcorefonts/verdana.ttf"
+, pointsize=>40, weight=>10, fill=>'yellow', text=>"$text",strokewidt
+h=>10, undercolor=>'green', x=>50, y=>$yPos);
warn "$x" if "$x";
#$image->Draw(stroke=>'red', primitive=>'rectangle', points=>'20,20 20
+0,200', x=>100, y=>100);
$x=$image->Write('SV000360_II.JPG');
warn "$x" if "$x";
If I leave off the "$text=chr(hex(0xa9))" line, the "©" symbol comes out as garbage. If I put that line in, I get the "©" symbol, but it is preceded by another garbage symbol. What am I doing wrong here?