johnfl68 has asked for the wisdom of the Perl Monks concerning the following question:
Hello all:
I am trying to consolidate some ImageMagick tasks with some arrayed data.
I have this:
and then this:my $imagen0 = Image::Magick->new; $imagen0->Set(size=>'128x70'); $imagen0->ReadImage('canvas:transparent'); $imagen0->Annotate(font=>"/fonts/trebucbd.ttf", pointsize=>24, fill=> +$fontcolor1, gravity=>'Center', text=>$p12hrn0); my $imagen1 = Image::Magick->new; $imagen1->Set(size=>'128x70'); $imagen1->ReadImage('canvas:transparent'); $imagen1->Annotate(font=>"/fonts/trebucbd.ttf", pointsize=>24, fill=> +$fontcolor1, gravity=>'Center', text=>$p12hrn1); my $imagen2 = Image::Magick->new; $imagen2->Set(size=>'128x70'); $imagen2->ReadImage('canvas:transparent'); $imagen2->Annotate(font=>"/fonts/trebucbd.ttf", pointsize=>24, fill=> +$fontcolor1, gravity=>'Center', text=>$p12hrn2); ...10 total
$image->Composite(geometry => '+188+675', image => $imagen0 ); $image->Composite(geometry => '+365+675', image => $imagen1 ); $image->Composite(geometry => '+542+675', image => $imagen2 ); ...10 total
And I am trying to simplify in a loop with this:
for my $i (@$times) { my $imagen($i) = Image::Magick->new; $imagen($i)->Set(size=>'128x70'); $imagen($i)->ReadImage('canvas:transparent'); $imagen($i)->Annotate(font=>"/fonts/trebucbd.ttf", pointsize=>24, +fill=> $fontcolor1, gravity=>'Center', text=>$i); } my $dayy = 675; my $dayx = 188; my $dayoff = 177; my $daygeo = ""; for my $i (@$times) { $daygeo = "+" . $dayx . "+" . $dayy; $image->Composite(geometry => $daygeo, image => $i ); $dayx = $dayx + $dayoff; }
The array $times is previously populated with text (Wednesday Night, Thursday, Thursday Night, ect.). I am guessing that it has something to do with creating an array for $imagen with ImageMagick, but I'm not quite sure how else to do this right now.
Thanks for your wisdom as always!
John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loop array with ImageMagick
by zentara (Cardinal) on Jul 19, 2012 at 10:53 UTC | |
|
Re: Loop array with ImageMagick
by Anonymous Monk on Jul 19, 2012 at 08:00 UTC | |
|
Re: Loop array with ImageMagick
by aitap (Curate) on Jul 19, 2012 at 09:27 UTC | |
|
Re: Loop array with ImageMagick
by johnfl68 (Scribe) on Jul 19, 2012 at 19:06 UTC |