in reply to Loop array with ImageMagick

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.

Hi, it's a little known fact-of-life that IM maintains a global stack of images that it uses for its own purposes, so you need to clear out the IM object after every run thru the loop. Whenever you read an image, it gets pushed into an internal array for storage. This useful sometimes, as in certain IM methods, all images can be processed by going thru this array. Of course, it also can get in the way sometimes, as you have seen. What you you probably need to do is undef @$my_IM_object, as shown here:

my $image = Image::Magick->new; foreach my $pic (@pics){ my $ok; $ok = $image->Read($pic) and warn ($ok); $image->Scale(geometry => '100x100'); $ok = $image->Write($thumb) and warn ($ok); # this is the key line undef @$image; #needed if $image is created outside loop
You can also read perldoc -q clear and read the first section "How do I clear out a package?".

Of course, this is just my top-of-the-morning guess at your problem, because your code dosn't even look like it will run correctly with things like my $imagen($i) =. That dosn't match any data structure commonly used in Perl.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh