From 8a049e9dfc1ab266e6f662195949ac5a060cdea9 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 10 Jul 2022 19:32:14 +0100 Subject: [PATCH] fix RGBA_ONLY with generic mono 1. Convert MULTIBAND uint/short/etc. as we convert uint8 images. They are probably just uint8 that have been cast up in format. 2. Don't check that the image interpretation is a supported colourspace before calling vips_colourspace() ... we want to fail with an error if it can't be converted, not silently accept the image. --- libvips/foreign/foreign.c | 1 - libvips/iofuncs/header.c | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 7597131e..1d35c954 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1464,7 +1464,6 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready, */ if( !coding[VIPS_CODING_RAD] && in->Bands < 3 && - vips_colourspace_issupported( in ) && saveable == VIPS_SAVEABLE_RGBA_ONLY ) { VipsImage *out; VipsInterpretation interpretation; diff --git a/libvips/iofuncs/header.c b/libvips/iofuncs/header.c index d11328ea..8f49bc37 100644 --- a/libvips/iofuncs/header.c +++ b/libvips/iofuncs/header.c @@ -590,6 +590,9 @@ vips_image_default_interpretation( const VipsImage *image ) switch( image->BandFmt ) { case VIPS_FORMAT_UCHAR: + case VIPS_FORMAT_SHORT: + case VIPS_FORMAT_UINT: + case VIPS_FORMAT_INT: switch( image->Bands ) { case 1: case 2: @@ -626,11 +629,6 @@ vips_image_default_interpretation( const VipsImage *image ) return( VIPS_INTERPRETATION_MULTIBAND ); } - case VIPS_FORMAT_SHORT: - case VIPS_FORMAT_UINT: - case VIPS_FORMAT_INT: - return( VIPS_INTERPRETATION_MULTIBAND ); - case VIPS_FORMAT_FLOAT: case VIPS_FORMAT_DOUBLE: switch( image->Bands ) {