Rich West on  wrote...
| I currently have a PERL script that takes an animated GIF and splits it
| in to its individual components, but it relies upon externally calling
| "convert" to perform the action:
|
| system("/usr/bin/convert +adjoin -coalesce " . $path . "anim.gif " .
| $path . "%01d");
| And then it relies on "ls" to determine how many pieces of the animated
| GIF were created:
| open (LS, "ls -l $path\* |");
| while (<LS>)
| {
|    ++$i if ((/$path/) && !(/anim.gif/));
| }
| close (LS);
| 
| But, really, that's just a hack.  I need to make it more portable, and I
| would like to use the Image::Magick perl module.  Documentation on this
| functionality is slim to start with (not putting any blame here), but I
| did find some which led me to the original solution of using "convert". 
| Unfortunately, I'm coming up completely dry when trying to come up with
| the right method for doing this in perl using the perl module..
| 
| Any ideas?
| 
Not bad, though you can find out how many frames an animation has by
using
   identify -format %n  animation.gif
on the original file.

I am sure there is something simular in the perl API .
Even if you have to set the format option and write an  "info:" blob!

----

Take a look at the 'gif2anim' script in IM examples
  http://www.imagemagick.org/Usage/scripts/gif2anim
and its usage examples
  http://www.imagemagick.org/Usage/anim_basics/anim_basics/#sequence

this script takes an GIF animation (optionally coaleasces it, with a -c
flag) names and outputs all the individual frames, and creates a file of
convert settings to re-build the animation with all the right timings,
and disposals, as well as some other info.

The last line in that file also will let you know how many frames the
image has, and you can even specify a different BASENAME for the output
files.

The script itself is a good demonstration of using identify to pull out
the appropriat info, including the number of frames in the image.

A sister script   anim2gif  can then rebuild of the GIF animation.

It is a good starting point for whatever you are trying to do.

Also look at http://www.imagemagick.org/Usage/animations/#append
for an example of using both scripts.


I do plan to expand these scripts with options to specify 'display
times' rather than 'delay times' so that I can merge two or more
animations (with different numbers of frames and timings) into a single
animation sequence, and still get all the timings right.  Assuming the
animations have equal timing loops.

Play with it as much as you like, and mail me (or the IM forum) any
feedback, suggestions, updates, etc etc etc    you like.

-------

Just so you know I am currently working on the next stage of GIF
animation tools for IM -layer.  This includes

* OptimizeTransparency
* Multi image Alpha Composing with
    +  Static background image,
    +  Static source image (like -draw image)
    +  Paired Images
* a -shuffle list operator to suffle images like cards
  (for the paired compose above)
* Remove Dupicate images next to each other (hopefully coalesced)
* Remove Zero Delay Intermediate Update Frames
  See Previous Disposal Animation, Frame Doubling,
  and Spliting Frame Update,  techniques.

Of course Cristy  kindly just added   -reverse   list operator
to reverse the image order in the current image sequence.
This makes creating cyclic or back-n-forth type animations a lot easier.


If you like some specific animation handling or editing operation,
NOW is a good time to request it of me.  :-)

  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
               A novice practices until he gets it right.
            An expert practices until he doesn't get it wrong.
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to