fix: make gif-loop consistent between GIF and WEBP

This commit is contained in:
Tomáš Szabo 2019-07-08 14:28:48 +02:00
parent 063234fde1
commit ab7ef2c2bc
No known key found for this signature in database
GPG Key ID: 96F1E84929851783
2 changed files with 7 additions and 4 deletions

View File

@ -471,8 +471,11 @@ vips_foreign_load_gif_scan_application_ext( VipsForeignLoadGif *gif,
if( have_netscape &&
extension &&
extension[0] == 3 &&
extension[1] == 1 )
gif->loop = extension[2] | (extension[3] << 8);
extension[1] == 1 ) {
gif->loop = extension[2] | (extension[3] << 8);
if (gif->loop != 0)
gif->loop = gif->loop + 1;
}
}
return( 0 );
@ -1142,7 +1145,7 @@ vips_foreign_load_gif_init( VipsForeignLoadGif *gif )
gif->transparency = -1;
gif->delays = NULL;
gif->delays_length = 0;
gif->loop = 0;
gif->loop = 1;
gif->comment = NULL;
gif->dispose = 0;
}

View File

@ -169,7 +169,7 @@ vips_foreign_save_magick_next_image( VipsForeignSaveMagick *magick )
*/
if( vips_image_get_typeof( im, "gif-loop" ) &&
!vips_image_get_int( im, "gif-loop", &number ) )
image->iterations = (size_t) (number ? number + 1 : 0);
image->iterations = (size_t) (number ? number : 0);
if( vips_image_get_typeof( im, "gif-comment" ) &&
!vips_image_get_string( im, "gif-comment", &str ) )