|
|
 |
 |
 |
 |
TCL(Tool Command Language) Scripting
|
 |
 |
 |
 |
 |
 |
 |
 |
image-gif
Hi, I'm trying to animate a gif image using $my_pic config -format "gif -index $index" It works ok, but some gifs show up strange. I guess it's because the frames are represented as differences from previous frames. How can I treat handle gifs?
iu2 wrote: > I'm trying to animate a gif image using > $my_pic config -format "gif -index $index" > It works ok, but some gifs show up strange. I guess it's because the > frames are represented as differences from previous frames. How can I > treat handle gifs?
That is correct in how GIF transitions are handled, but if you start from 0 and go up in sequential order, Tk should handle the drawing correctly. Can you specify what you mean by "strange"? Jeff
On May 31, 8:15 pm, Jeff Hobbs <j@activestate.com> wrote: > iu2 wrote: > > I'm trying to animate a gif image using > > $my_pic config -format "gif -index $index" > > It works ok, but some gifs show up strange. I guess it's because the > > frames are represented as differences from previous frames. How can I > > treat handle gifs? > That is correct in how GIF transitions are handled, but if you start > from 0 and go up in sequential order, Tk should handle the drawing > correctly. Can you specify what you mean by "strange"?
Check for yourself with for example: http://www.gifs.net/Animation11/Webdesign_Elements/Random_Shapes/Cube... When loaded with [image create photo -file $fn], if you image1 config -format gif it is OK, but if you image1 config -format "gif -index $index" even with values in increasing order 0,1,2,... you'll see corners of the previous frame "not refreshed" around the new one (which gets smaller in this specific example). This happens regardless of the rendering widget(s). I put it in both a label and a canvas, and the "shattered" image appears and updates in both places. So this really happens in the in-memory image, it's not a rendering problem. Sounds like a bug of the assumption made by the gif decoder about what's already in the buffer. -Alex
On May 31, 8:15 pm, Jeff Hobbs <j@activestate.com> wrote: > iu2 wrote: > > I'm trying to animate a gif image using > > $my_pic config -format "gif -index $index" > > It works ok, but some gifs show up strange. I guess it's because the > > frames are represented as differences from previous frames. How can I > > treat handle gifs? > That is correct in how GIF transitions are handled, but if you start > from 0 and go up in sequential order, Tk should handle the drawing > correctly. Can you specify what you mean by "strange"? > Jeff
Well, I animate one of those smilies available for emails, and the smily looks "drowned" inside a gray square, having also several gray shapless forms inside its yellow cute face... :-) I used the following script to animate it: package require img::gif proc main {} { label .lbl pack .lbl set m [image create photo -file "definitive no.gif"] anim $m .lbl 40 0 }
proc anim {pic lbl delay index} { if {[catch {$pic config -format "gif -index $index"}]} {after $delay "anim $pic $lbl $delay 0"} { $lbl config -image $pic after $delay [list anim $pic $lbl $delay [incr index]] } }
main
|
 |
 |
 |
 |
|