diff --git a/ChangeLog b/ChangeLog index 8e30db87..6535460f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ 9/8/20 started 8.10.1 - fix markdown -> xml conversion in doc generation - remove typedef redefinitions to please old gccs +- fix regression in tiff pyramid thumbnailing [tand826] +- stop 0-length buffer being passed to imagemagick [lovell] +- convert no-profile CMYK to RGB on save [augustocdias] 24/1/20 started 8.10.0 - more conformat IIIF output from dzsave [regisrob] diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 0459c47f..37e92768 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1336,8 +1336,7 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready, } /* If this image is CMYK and the saver is RGB-only, use lcms to try to - * import to XYZ. This will only work if the image has an embedded - * profile. + * import to XYZ. */ if( in->Type == VIPS_INTERPRETATION_CMYK && in->Bands >= 4 && @@ -1348,6 +1347,8 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready, if( vips_icc_import( in, &out, "pcs", VIPS_PCS_XYZ, + "embedded", TRUE, + "input_profile", "cmyk", NULL ) ) { g_object_unref( in ); return( -1 ); diff --git a/libvips/resample/thumbnail.c b/libvips/resample/thumbnail.c index 5f71943f..1b6a7862 100644 --- a/libvips/resample/thumbnail.c +++ b/libvips/resample/thumbnail.c @@ -135,10 +135,14 @@ typedef struct _VipsThumbnail { int heif_thumbnail_width; int heif_thumbnail_height; - /* For TIFF sources, open subifds rather than pages to get pyr layers. + /* For TIFF sources, open subifds to get pyr layers. */ gboolean subifd_pyramid; + /* For TIFF sources, open pages to get pyr layers. + */ + gboolean page_pyramid; + } VipsThumbnail; typedef struct _VipsThumbnailClass { @@ -261,13 +265,10 @@ vips_thumbnail_get_tiff_pyramid_page( VipsThumbnail *thumbnail ) /* Single-page docs can't be pyramids. */ - if( thumbnail->n_loaded_pages < 2 ) + if( thumbnail->n_pages < 2 ) return; - /* Use n_loaded_pages not n_pages since we support thumbnailing a page - * or range of pages from a many-page tiff. - */ - for( i = 0; i < thumbnail->n_loaded_pages; i++ ) { + for( i = 0; i < thumbnail->n_pages; i++ ) { VipsImage *page; int level_width; int level_height; @@ -301,9 +302,9 @@ vips_thumbnail_get_tiff_pyramid_page( VipsThumbnail *thumbnail ) #ifdef DEBUG printf( "vips_thumbnail_get_tiff_pyramid_page: " "%d layer pyramid detected\n", - thumbnail->n_loaded_pages ); + thumbnail->n_pages ); #endif /*DEBUG*/ - thumbnail->level_count = thumbnail->n_loaded_pages; + thumbnail->level_count = thumbnail->n_pages; } /* Detect a TIFF pyramid made of subifds following a roughly /2 shrink. @@ -549,7 +550,12 @@ vips_thumbnail_open( VipsThumbnail *thumbnail ) if( thumbnail->level_count == 0 ) { thumbnail->subifd_pyramid = FALSE; + thumbnail->page_pyramid = TRUE; + vips_thumbnail_get_tiff_pyramid_page( thumbnail ); + + if( thumbnail->level_count == 0 ) + thumbnail->page_pyramid = FALSE; } } @@ -1060,7 +1066,7 @@ vips_thumbnail_file_open( VipsThumbnail *thumbnail, double factor ) "access", VIPS_ACCESS_SEQUENTIAL, "subifd", (int) factor, NULL ) ); - else if( thumbnail->level_count > 0 ) + else if( thumbnail->page_pyramid ) return( vips_image_new_from_file( file->filename, "access", VIPS_ACCESS_SEQUENTIAL, "page", (int) factor,