Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay of GIF animation changes #2582

Closed
dloebl opened this issue Dec 17, 2021 · 3 comments
Closed

Delay of GIF animation changes #2582

dloebl opened this issue Dec 17, 2021 · 3 comments
Labels

Comments

@dloebl
Copy link
Contributor

dloebl commented Dec 17, 2021

Sorry for yet another GIF issue 馃槄

For the following GIF the delay changes when doing a copy via vips. After the first frame, a delay of one second is added.
test

$ vips copy test.gif[n=-1] out.gif
out

In the input GIF, the graphic control extension for the first frame is missing.
To me it looks as if the decoder sets some kind of placeholder delay to 100cs when no graphic control extension is present.

$ vips --vips-version
libvips 8.12.1-Wed Nov 24 15:41:04 UTC 2021
@dloebl dloebl added the bug label Dec 17, 2021
@jcupitt
Copy link
Member

jcupitt commented Dec 17, 2021

Hi @dloebl,

You're right, I see:

$ vipsheader -a bugs.gif 
bugs.gif: 500x355 uchar, 4 bands, srgb, gifload
width: 500
height: 355
bands: 4
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 1
yres: 1
filename: bugs.gif
vips-loader: gifload
n-pages: 12
loop: 0
delay: 1000 0 0 0 0 0 0 0 0 0 0 0 
background: 20 20 20 

Which is obviously not very useful.

@jcupitt
Copy link
Member

jcupitt commented Dec 18, 2021

Yes, looks like libnsgif defaults to 100cs for the frame delay:

https://github.com/libvips/libvips/blob/master/libvips/foreign/libnsgif/libnsgif.c#L1006

The usual GIF default is 10fps I think, so perhaps this should be 10? I'll patch it.

jcupitt added a commit that referenced this issue Dec 18, 2021
This is the delay if the GCB is missing.

See #2582
jcupitt added a commit that referenced this issue Dec 18, 2021
@jcupitt
Copy link
Member

jcupitt commented Dec 18, 2021

vips copy bugs.gif[n=-1] x.gif

Now makes this:

x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants