revise page-height rules again

Only set `page-height` if `n` is set as an argument. This means you only
get a multi-page image if you specifically ask for it.
This commit is contained in:
John Cupitt 2019-05-29 14:18:46 +01:00
parent bd8a6980f5
commit 675c6361eb
6 changed files with 6 additions and 8 deletions

View File

@ -571,7 +571,7 @@ vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image )
1.0, 1.0 ); 1.0, 1.0 );
vips_image_pipelinev( image, VIPS_DEMAND_STYLE_FATSTRIP, NULL ); vips_image_pipelinev( image, VIPS_DEMAND_STYLE_FATSTRIP, NULL );
if( gif->n > 1 ) if( vips_object_argument_isset( VIPS_OBJECT( gif ), "n" ) )
vips_image_set_int( image, vips_image_set_int( image,
VIPS_META_PAGE_HEIGHT, gif->file->SHeight ); 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 );

View File

@ -382,7 +382,7 @@ 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, "heif-primary", heif->primary_page );
vips_image_set_int( out, "n-pages", heif->n_top ); vips_image_set_int( out, "n-pages", heif->n_top );
if( heif->n > 1 ) if( vips_object_argument_isset( VIPS_OBJECT( heif ), "n" ) )
vips_image_set_int( out, vips_image_set_int( out,
VIPS_META_PAGE_HEIGHT, heif->page_height ); VIPS_META_PAGE_HEIGHT, heif->page_height );

View File

@ -595,7 +595,7 @@ vips_foreign_load_magick7_parse( VipsForeignLoadMagick7 *magick7,
/* So we can finally set the height. /* So we can finally set the height.
*/ */
if( magick7->n_frames > 1 ) { if( vips_object_argument_isset( VIPS_OBJECT( magick7 ), "n" ) ) {
vips_image_set_int( out, VIPS_META_PAGE_HEIGHT, out->Ysize ); vips_image_set_int( out, VIPS_META_PAGE_HEIGHT, out->Ysize );
out->Ysize *= magick7->n_frames; out->Ysize *= magick7->n_frames;
} }

View File

@ -505,7 +505,7 @@ vips_foreign_load_nifti_set_header( VipsForeignLoadNifti *nifti,
vips_image_set_blob_copy( out, txt, ext->edata, ext->esize ); vips_image_set_blob_copy( out, txt, ext->edata, ext->esize );
} }
if( nim->ny > 1 ) if( vips_object_argument_isset( VIPS_OBJECT( nifti ), "n" ) )
vips_image_set_int( out, VIPS_META_PAGE_HEIGHT, nim->ny ); vips_image_set_int( out, VIPS_META_PAGE_HEIGHT, nim->ny );
return( 0 ); return( 0 );

View File

@ -363,8 +363,7 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
for( i = 1; i < pdf->n; i++ ) for( i = 1; i < pdf->n; i++ )
if( pdf->pages[i].height != pdf->pages[0].height ) if( pdf->pages[i].height != pdf->pages[0].height )
break; break;
if( i == pdf->n && if( vips_object_argument_isset( VIPS_OBJECT( pdf ), "n" ) )
pdf->n > 1 )
vips_image_set_int( load->out, vips_image_set_int( load->out,
VIPS_META_PAGE_HEIGHT, pdf->pages[0].height ); VIPS_META_PAGE_HEIGHT, pdf->pages[0].height );

View File

@ -317,8 +317,7 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
for( i = 1; i < pdf->n; i++ ) for( i = 1; i < pdf->n; i++ )
if( pdf->pages[i].height != pdf->pages[0].height ) if( pdf->pages[i].height != pdf->pages[0].height )
break; break;
if( i == pdf->n && if( vips_object_argument_isset( VIPS_OBJECT( pdf ), "n" ) )
pdf->n > 1 )
vips_image_set_int( load->out, vips_image_set_int( load->out,
VIPS_META_PAGE_HEIGHT, pdf->pages[0].height ); VIPS_META_PAGE_HEIGHT, pdf->pages[0].height );