more consistent behaviour for multi-page load
Some loaders were setting page-height even when the user was loading a single page triggering unexpected multi-page behaviour from later savers. New rule: only set page-height when loading more than one page. See https://github.com/libvips/libvips/issues/1318
This commit is contained in:
parent
c7e213a9fa
commit
bd8a6980f5
@ -1,6 +1,7 @@
|
||||
24/5/19 started 8.8.1
|
||||
- improve realpath() use on older libc
|
||||
- better magickload error messages
|
||||
- more consistent behaviour for page-height metadata
|
||||
|
||||
21/9/18 started 8.8.0
|
||||
- much faster smartcrop [lovell]
|
||||
|
@ -11,7 +11,7 @@ libforeign_la_SOURCES = \
|
||||
gifload.c \
|
||||
cairo.c \
|
||||
pdfload.c \
|
||||
pdfload_pdfium.c \
|
||||
pdfiumload.c \
|
||||
svgload.c \
|
||||
radiance.c \
|
||||
radload.c \
|
||||
|
@ -571,11 +571,10 @@ vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image )
|
||||
1.0, 1.0 );
|
||||
vips_image_pipelinev( image, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
|
||||
|
||||
if( gif->n_pages > 1 ) {
|
||||
if( gif->n > 1 )
|
||||
vips_image_set_int( image,
|
||||
VIPS_META_PAGE_HEIGHT, gif->file->SHeight );
|
||||
vips_image_set_int( image, VIPS_META_N_PAGES, gif->n_pages );
|
||||
}
|
||||
vips_image_set_int( image, VIPS_META_N_PAGES, gif->n_pages );
|
||||
vips_image_set_int( image, "gif-delay", gif->delay );
|
||||
vips_image_set_int( image, "gif-loop", gif->loop );
|
||||
if( gif->comment )
|
||||
|
@ -382,7 +382,9 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||
|
||||
vips_image_set_int( out, "heif-primary", heif->primary_page );
|
||||
vips_image_set_int( out, "n-pages", heif->n_top );
|
||||
vips_image_set_int( out, "page-height", heif->page_height );
|
||||
if( heif->n > 1 )
|
||||
vips_image_set_int( out,
|
||||
VIPS_META_PAGE_HEIGHT, heif->page_height );
|
||||
|
||||
/* FIXME .. we always decode to RGB in generate. We should check for
|
||||
* all grey images, perhaps.
|
||||
|
@ -363,7 +363,8 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
|
||||
for( i = 1; i < pdf->n; i++ )
|
||||
if( pdf->pages[i].height != pdf->pages[0].height )
|
||||
break;
|
||||
if( i == pdf->n )
|
||||
if( i == pdf->n &&
|
||||
pdf->n > 1 )
|
||||
vips_image_set_int( load->out,
|
||||
VIPS_META_PAGE_HEIGHT, pdf->pages[0].height );
|
||||
|
@ -317,7 +317,8 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
|
||||
for( i = 1; i < pdf->n; i++ )
|
||||
if( pdf->pages[i].height != pdf->pages[0].height )
|
||||
break;
|
||||
if( i == pdf->n )
|
||||
if( i == pdf->n &&
|
||||
pdf->n > 1 )
|
||||
vips_image_set_int( load->out,
|
||||
VIPS_META_PAGE_HEIGHT, pdf->pages[0].height );
|
||||
|
||||
|
@ -467,7 +467,8 @@ read_header( Read *read, VipsImage *out )
|
||||
#endif /*DEBUG*/
|
||||
|
||||
vips_image_set_int( out, "gif-loop", loop_count );
|
||||
vips_image_set_int( out, "page-height", read->frame_height );
|
||||
vips_image_set_int( out,
|
||||
VIPS_META_PAGE_HEIGHT, read->frame_height );
|
||||
|
||||
/* We must get the first frame to get the delay. Frames number
|
||||
* from 1.
|
||||
|
Loading…
Reference in New Issue
Block a user