Version 5 of AniGif

Updated 2004-07-27 17:01:45 by suchenwi

What: AniGif

 Where: http://cardtable.go.to/tcltk/ 
 Description: Tk extension allowing you to create, start, stop, restart
        and destroy animated GIFs.  Supports single play images as well as
        images without full image data on each frame.
        Use gifsicle to uncompress compressed/interlaced GIFs before
        subsequent processing.
        Currently at version 1.3 .
 Updated: 03/2002
 Contact: mailto:[email protected] 

RS 2004-07-27: Also, using the widespread Img extension, you have access to the partial images of an animated GIF. This code was enough for me:

 package require Img

 proc anigif file {
    #-- returns a list of images from the given GIF file
    set index 0
    set results {}
    while 1 {
        if [catch {
            image create photo -file $file -format "gif -index $index"
        } res] {
            return $results
        }
        lappend results $res
        incr index
    }    
 }

#-- Testing (dumping the animation phases, one next to the other, into a text widget):

http://mini.net/files/anigif.jpg Test image: http://mini.net/files/underconstruction.gif

#-- Testing (dumping the animation phases into a text widget, and an animation):

 proc lcycle listName {
    upvar 1 $listName list
    set res [lindex $list 0]
    set list [concat [lrange $list 1 end] [list $res]]
    set res
 }
 proc every {ms body} {eval $body; after $ms [info level 0]}
 set file [lindex $argv 0]

 pack [text .t]
 set images [anigif $file]
 foreach img $images {
    .t image create end -image $img
 }
 .t insert end animated:
 set id [.t image create end -image [lindex $images 0]]
 every 100 ".t image config $id -image \[lcycle ::images\]"

Category Package Category Graphics