I've already realized I can simply write to generic files while iterating a batch of images, over writing as I go, and making the gif animations as I process the other files. BUT! I find it hard to believe the use of $image->Read() does not accept variables.
My understanding is that the method populates an array of images, and then uses those to build the gif. But documentation (that I've found so far...) does not illustrate beyond static filenames as acceptable to the Read() method, and my efforts at using variables, have reliably failed.
I've run a test script in a directory with the png files png1.png and png2.png, which are verified to build into a working gif, from bash/imagemagick. Here's my test script:
Code: Select all
#!/usr/bin/env perl #perl-jsiiw-Read-fail.pl: testing program for the Image::Magick Read method. use strict; use warnings; use Image::Magick; my ($p1, $p2); # to use static png files for test purposes. Known OK. my $x; # This will be the image file. my $y = "outputgif.gif"; my $wtf; # for return code. $x = Image::Magick->new; $p1 = "'png1.png'"; # note: these two strings include single quotes. $p2 = "'png2.png'"; # also, strong (single) quoting $xx in $image->Read('$p1'); # prevents variables from expanding. (??) (This I do not yet know.) $x->Set('delay=350'); $x->Set('loop=0'); $wtf=$x->Read($p1); # does not work, gives 420 exception. $wtf=$x->Read('png1.png'); # works, but is hard coded into program. Huh? warn $wtf if $wtf; $wtf=$x->Read($p2); # does not work, gives 420 exception. $wtf=$x->Read('png2.png'); # works, but is hard coded into program. Huh? warn $wtf if $wtf; $wtf=$x->Write($y);
I hope this is not a waste of your time. If I could at least get some clarification on the Read() method. Perhaps this is a perl basic, regarding objects and methods, but like I said, I'm new, and working with what I can find out.