kimgio: do not attempt to load images in YUV, e-YCC and CMYK color space

if the decoder cannot tell (correctly) the color space then.. idk

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-11-27 18:16:30 +02:00
parent ac32164782
commit a0afe27554

View file

@ -188,6 +188,28 @@ bool JP2Handler::read(QImage *image)
return false;
}
switch (ojimage->color_space) {
case OPJ_CLRSPC_UNKNOWN:
case OPJ_CLRSPC_UNSPECIFIED: {
// NOTE: there are images with unspecified and unknown color space that are sRGB but
// in case it is not sRGB and it looks weird when it is loaded tell the person who
// created the image to fix it somehow
kDebug() << "Unspecified or unknown color space";
break;
}
case OPJ_CLRSPC_SRGB:
case OPJ_CLRSPC_GRAY: {
break;
}
default: {
kWarning() << "Unsupported color space" << ojimage->color_space;
opj_destroy_codec(ojcodec);
opj_stream_destroy(ojstream);
opj_image_destroy(ojimage);
return false;
}
}
switch (ojimage->numcomps) {
case 4: {
QRgb* imagebits = reinterpret_cast<QRgb*>(image->bits());