Cannot for the life of me get annotate to do anything
Posted: 2012-05-30T08:47:37-07:00
I've been working for two days to try to add some text to an image and nothing I try works.
I started on Solaris simply using 'convert' to try and do it. In most cases the image is created fine but never with any text. Here are some of the things I tried:
# convert L1522.tif -background White label:'Faerie Dragon' +swap -gravity Center -append crop.tif
# convert L1522.tif -gravity North -background White label:"Faerie Dragon" crop.tif
# convert L1522.tif -annotate +5+5 'Something' crop.tif
# convert L8320.tif -annotate 0 'something' -fill black crop.tif
# convert L7726.tif -draw 'rectangle 5,128,114,145' -font 'Times New Roman' -fill white -annotate +10+10 'this' crop.jpg
# convert L7726.tif -background lightblue -fill blue -font Arial -size 165x70 -pointsize 12 label:Anthony crop.gif
# convert crop.jpg -background Khaki label:'Faerie Dragon' +swap -gravity Center -append crop2.jpg
The closest to success I got was using '-draw'. I got a small black rectangle but no visible text inside.
Then I read there may be issues with the way ImageMagick was installed, some components needed for annotation might not have been included, so I switched to using Windows and still no luck. I installed Ghostscript first as was recommended. Then I installed PerlMagick and used the sample program below:
use strict vars;
use Image::Magick;
my $p = new Image::Magick;
$p->Read('L8728.tif');
#$p->Annotate(font=>'times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
$p->Annotate(font=>'c:\Windows\Fonts\times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
#$p->Label(font=>'times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
$p->Write ('crop.jpg');
In all cases trying different things I get a perfectly good jpeg out but any added text is never to be seen. The source tiffs are 2000px wide and 400px high. Help! I've looked at all the examples I could find online, tried everything in the official documentation. I don't get any error messages.
Right now I'm using ImageMagick-6.7.7-Q16 on 32-bit Windows XP.
I started on Solaris simply using 'convert' to try and do it. In most cases the image is created fine but never with any text. Here are some of the things I tried:
# convert L1522.tif -background White label:'Faerie Dragon' +swap -gravity Center -append crop.tif
# convert L1522.tif -gravity North -background White label:"Faerie Dragon" crop.tif
# convert L1522.tif -annotate +5+5 'Something' crop.tif
# convert L8320.tif -annotate 0 'something' -fill black crop.tif
# convert L7726.tif -draw 'rectangle 5,128,114,145' -font 'Times New Roman' -fill white -annotate +10+10 'this' crop.jpg
# convert L7726.tif -background lightblue -fill blue -font Arial -size 165x70 -pointsize 12 label:Anthony crop.gif
# convert crop.jpg -background Khaki label:'Faerie Dragon' +swap -gravity Center -append crop2.jpg
The closest to success I got was using '-draw'. I got a small black rectangle but no visible text inside.
Then I read there may be issues with the way ImageMagick was installed, some components needed for annotation might not have been included, so I switched to using Windows and still no luck. I installed Ghostscript first as was recommended. Then I installed PerlMagick and used the sample program below:
use strict vars;
use Image::Magick;
my $p = new Image::Magick;
$p->Read('L8728.tif');
#$p->Annotate(font=>'times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
$p->Annotate(font=>'c:\Windows\Fonts\times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
#$p->Label(font=>'times.ttf', pointsize=>40, fill=>'green', text=>'Blah!');
$p->Write ('crop.jpg');
In all cases trying different things I get a perfectly good jpeg out but any added text is never to be seen. The source tiffs are 2000px wide and 400px high. Help! I've looked at all the examples I could find online, tried everything in the official documentation. I don't get any error messages.
Right now I'm using ImageMagick-6.7.7-Q16 on 32-bit Windows XP.