stop making tiff pyr if axis drops to 1

TIFF pyramids of images with a very extreme aspect raio could see layer
width or height drop to 0 before the image fitted in a single tile. This
change stops pyramid creation when width or height drop to 1.

See https://github.com/libvips/libvips/issues/1188
This commit is contained in:
John Cupitt 2018-12-21 14:47:28 +00:00
parent 99c0a674a4
commit d35343f817
2 changed files with 18 additions and 2 deletions

View File

@ -12,6 +12,7 @@
- don't stop composite on first non-transparent image [felixbuenemann, GDmac]
- add vips_rect_overlapsrect()
- composite is much faster at positioning subimages
- stop tiff pyr layers if width or height drop to 1 [gvincke]
21/11/18 started 8.7.3
- fix infinite loop for autofit with non-scaleable font

View File

@ -178,6 +178,8 @@
* write multipage
* 2/7/18
* - copy EXTRASAMPLES to pyramid layers
* 21/12/18
* - stop pyr layers if width or height drop to 1
*/
/*
@ -395,9 +397,22 @@ wtiff_layer_new( Wtiff *wtiff, Layer *above, int width, int height )
layer->below = NULL;
layer->above = above;
/*
printf( "wtiff_layer_new: sub = %d, width = %d, height = %d\n",
layer->sub, width, height );
*/
if( wtiff->pyramid )
if( layer->width > wtiff->tilew ||
layer->height > wtiff->tileh )
/* We make another layer if the image is too large to fit in a
* single tile, and if neither axis is greater than 1.
*
* Very tall or wide images might end up with a smallest layer
* larger than one tile.
*/
if( (layer->width > wtiff->tilew ||
layer->height > wtiff->tileh) &&
layer->width > 1 &&
layer->height > 1 )
layer->below = wtiff_layer_new( wtiff, layer,
width / 2, height / 2 );