improve colourspace guessing in icc

icc_transform does a better job of guessing the colourspace of an image -- if
the colourspace has not been set (generic multiband), it'll look at the
image bands instead and guess from that

see https://github.com/jcupitt/libvips/issues/971
This commit is contained in:
John Cupitt 2018-05-12 11:05:08 +01:00
parent be4803677d
commit 265fb2a825
1 changed files with 23 additions and 1 deletions

View File

@ -540,9 +540,31 @@ vips_image_expected_sig( VipsImage *image )
expected_sig = cmsSigYxyData;
break;
case VIPS_INTERPRETATION_MULTIBAND:
/* A generic many-band image. Try to guess from the number of
* image bands instead.
*/
switch( image->Bands ) {
case 1:
expected_sig = cmsSigGrayData;
break;
case 3:
expected_sig = cmsSigRgbData;
break;
case 4:
expected_sig = cmsSigCmykData;
break;
default:
expected_sig = -1;
break;
}
break;
case VIPS_INTERPRETATION_LCH:
case VIPS_INTERPRETATION_CMC:
case VIPS_INTERPRETATION_MULTIBAND:
case VIPS_INTERPRETATION_HISTOGRAM:
case VIPS_INTERPRETATION_MATRIX:
case VIPS_INTERPRETATION_FOURIER: