I'm trying to use PerlMagick to build out a semi-opaque caption box. The following ImageMagick command works (with one nuance to deal with) pretty well. It creates the box, captions the data in the file "updatelabel' and outputs it right-justified in the box, then merges the caption box on the main graphic.
convert -background '#0008' -fill white -display 90 -pointsize 16 -gra +vity east -size 500x100 \ caption:'@updatelabel' \ rectangular.jpg +swap -geometry +500+100 -gravity southeast -composit +e rectangle.jpg
The nuance is that the caption is all one color. What is needed is to have each line control it's own color (that's based on specific file parameters and I have that elsewhere).
I built the following in PerlMagick and immediately ran into several problems, for which I am seeking the wisdom of the Monks.
#!/usr/bin/perl use strict; use warnings; use Image::magick; my $image; $image = Image::Magick->new; open( IMAGE, '/Users/coblem/testing/rectangular.jpg' ); $image->Read( file=>\*IMAGE ); my $box; $box->Draw( primitive=>'rectangle', points=>'900,1000 1400,1180'); $box->Qpaque( color=>'#0008'); #$image->Annotate( gravity=>'southeast', font=>'Arial', pointsize=>20, + fill=>'red', x=>500, y=>100, text=>"Quake Information Last Updated + at: Mon Jul 1 21:09:46 2013" ); open( IMAGE, ">/Users/coblemtesting/rectangle.jpg" ); $image->write( file=>\*IMAGE, filename=>'/Users/coblem/testing/rectang +le.jpg' ); close (IMAGE);
First, I thought I could just build a box, fill it, then set the opacity, then annotate it (note the commented line can control the text color uniquely; the plan was to repeat this command as often as needed, adjusting the vertical location for each line); and then merge everything onto the main graphic.
The first issue is that Opaque isn't a valid module (although the instructions sure read like it is). Second issue is that I'm struggling to get the box to be semi-transparent - I can't figure that one out at all, although CAPTION seems to do it natively. Third, if I could substitute ANNOTATE for CAPTION I would have control over the color of each line of text in the box. And I can't figure out that one even in ImageMagick (but that's not really a Perl question).
Questions:
I would show you the graphic with caption, but I have no idea how to attach an image.
Thanks (in advance) for your suggestions!
Matt
In reply to Caption-like text with PerlMagick by mcoblentz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |