Skip to content

Commit

Permalink
add animated webp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Nov 27, 2018
1 parent 4e18244 commit 24abbb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libvips/foreign/vips2webp.c
Expand Up @@ -42,9 +42,9 @@
*/ */


/* /*
*/
#define DEBUG #define DEBUG
#define VIPS_DEBUG #define VIPS_DEBUG
*/


#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
Expand Down Expand Up @@ -432,8 +432,8 @@ vips_webp_add_chunks( VipsWebPWrite *write, VipsImage *image )
{ {
int i; int i;


if( vips_image_get_typeof( image, "gif-count" ) ) if( vips_image_get_typeof( image, "gif-loop" ) )
vips_webp_set_count( write, get_int( image, "gif-count", 0 ) ); vips_webp_set_count( write, get_int( image, "gif-loop", 0 ) );


for( i = 0; i < vips__n_webp_names; i++ ) { for( i = 0; i < vips__n_webp_names; i++ ) {
const char *vips_name = vips__webp_names[i].vips; const char *vips_name = vips__webp_names[i].vips;
Expand Down
12 changes: 12 additions & 0 deletions test/test-suite/test_foreign.py
Expand Up @@ -492,6 +492,18 @@ def webp_valid(im):
y = pyvips.Image.new_from_buffer(buf, "") y = pyvips.Image.new_from_buffer(buf, "")
assert y.get("orientation") == 6 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") @skip_if_no("analyzeload")
def test_analyzeload(self): def test_analyzeload(self):
def analyze_valid(im): def analyze_valid(im):
Expand Down

0 comments on commit 24abbb8

Please sign in to comment.