diff --git a/libvips/foreign/vips2webp.c b/libvips/foreign/vips2webp.c index ace07a0a34..2754f47289 100644 --- a/libvips/foreign/vips2webp.c +++ b/libvips/foreign/vips2webp.c @@ -42,9 +42,9 @@ */ /* - */ #define DEBUG #define VIPS_DEBUG + */ #ifdef HAVE_CONFIG_H #include @@ -432,8 +432,8 @@ vips_webp_add_chunks( VipsWebPWrite *write, VipsImage *image ) { int i; - if( vips_image_get_typeof( image, "gif-count" ) ) - vips_webp_set_count( write, get_int( image, "gif-count", 0 ) ); + if( vips_image_get_typeof( image, "gif-loop" ) ) + vips_webp_set_count( write, get_int( image, "gif-loop", 0 ) ); for( i = 0; i < vips__n_webp_names; i++ ) { const char *vips_name = vips__webp_names[i].vips; diff --git a/test/test-suite/test_foreign.py b/test/test-suite/test_foreign.py index c4383437b7..b92940c956 100644 --- a/test/test-suite/test_foreign.py +++ b/test/test-suite/test_foreign.py @@ -492,6 +492,18 @@ def webp_valid(im): y = pyvips.Image.new_from_buffer(buf, "") assert y.get("orientation") == 6 + # try converting an animated gif to webp ... can't do back to gif + # again without IM support + if have("gifload"): + x1 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1) + w1 = x1.webpsave_buffer(Q=10) + x2 = pyvips.Image.new_from_buffer(w1, "", n=-1) + assert x1.width == x2.width + assert x1.height == x2.height + assert x1.get("gif-delay") == x2.get("gif-delay") + assert x1.get("page-height") == x2.get("page-height") + assert x1.get("gif-loop") == x2.get("gif-loop") + @skip_if_no("analyzeload") def test_analyzeload(self): def analyze_valid(im):