diff --git a/libvips/foreign/gifload.c b/libvips/foreign/gifload.c index 4860a66e..60c6af57 100644 --- a/libvips/foreign/gifload.c +++ b/libvips/foreign/gifload.c @@ -18,6 +18,8 @@ * 21/11/17 * - add "gif-delay", "gif-loop", "gif-comment" metadata * - add dispose handling + * 13/8/18 + * - init pages to 0 before load */ /* @@ -779,6 +781,13 @@ vips_foreign_load_gif_new_page( VipsForeignLoadGif *gif ) return( NULL ); } + /* Some GIFs may not clear the background, so we must start + * transparent. + */ + memset( VIPS_IMAGE_ADDR( out, 0, 0 ), + 0, + VIPS_IMAGE_SIZEOF_IMAGE( out ) ); + return( out ); }