don't set page-height in thumbnail unless we must

We were always setting page-height in thumbnail, even on single-frame
images. This could cause problems if the image height was later
increased by a factor of the height -- non-animated images could
accidentally turn into animated images.

https://github.com/libvips/libvips/issues/1469
This commit is contained in:
John Cupitt 2020-01-06 17:04:01 +00:00
parent 0cdf00a9ba
commit 5b09845bd5
1 changed files with 7 additions and 2 deletions

View File

@ -677,8 +677,13 @@ vips_thumbnail_build( VipsObject *object )
return( -1 );
in = t[13];
output_page_height = VIPS_RINT( preshrunk_page_height / vshrink );
vips_image_set_int( in,
VIPS_META_PAGE_HEIGHT, output_page_height );
/* Only set page-height if we have more than one page, or this could
* accidentally turn into an animated image later.
*/
if( thumbnail->n_loaded_pages > 1 )
vips_image_set_int( in,
VIPS_META_PAGE_HEIGHT, output_page_height );
if( have_premultiplied ) {
g_info( "unpremultiplying alpha" );