Menu

#6 Need help with gif animation implementation

v1.0_(example)
closed
nobody
None
1
2024-02-18
2017-11-27
No

I'm trying to add an interface to build animated gifs in leptonica
(github.com/danbloomberg/leptonica)

I'm calling EGifPutScreenDesc() once for the first image; then for each,
EGifPutImageDesc(), followed by the image data.

This makes a multi-image gif, but each image is overlayed and, for example, the chrome browser doesn't cycle through them. An example is attached, with 2 embedded images.

So I tried to get the time delay in with a graphics control block, as shown in giftool.c.

As each image is being added, I tried something like:

GifFileType *gif;
GraphicsControlBlock gcb;
(... code to open the gif handle ...)
n = pixaGetCount(pixa);
for (i = 0; i < n; i++) {
gcb.DelayTime = 1.0;
EGifGCBToSavedExtension(&gcb, gif, i);
pix = pixaGetPix(pixa, i, L_COPY);
pixSetPadBits(pix, 0);
result = pixToGif(pix, gif, i); // index i just says to call
// EGifPutScreenDesc only for i = 0
pixDestroy(&pix);
}

This didn't make any difference. When I ran
identify -verbose
on the output gif, there was no Delay field, as you have for an animated gif.

It would also be nice if there were an example in the tools directory for how to do this.

Thanks.

Discussion

  • Eric S. Raymond

    Eric S. Raymond - 2019-02-11

    I'm working on the giflib bug queue (it took a while I because don't do releases very often).

    Did you ever find a way to make the API do what you want? I've never had yto try it myself.

     
  • Eric S. Raymond

    Eric S. Raymond - 2024-02-18
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.