} else if ((iccCS != null) &&
(cm.getNumComponents() == numComponents) &&
(cs != iccCS)) {
// We have an ICC profile but it isn't used in the dest
// image. So convert from the profile cs to the target cs
convert = new ColorConvertOp(iccCS, cs, null);
// Leave IJG conversion in place; we still need it
} else if ((iccCS == null) &&
(!cs.isCS_sRGB()) &&
(cm.getNumComponents() == numComponents)) {
// Target isn't sRGB, so convert from sRGB to the target
convert = new ColorConvertOp(JPEG.JCS.sRGB, cs, null);
} else if (csType != ColorSpace.TYPE_RGB) {
throw new IIOException("Incompatible color conversion");
}
break;
case JPEG.JCS_RGBA:
// No conversions available; image must be RGBA
if ((csType != ColorSpace.TYPE_RGB) ||
(cm.getNumComponents() != numComponents)) {
throw new IIOException("Incompatible color conversion");
}
break;
case JPEG.JCS_YCC:
{
ColorSpace YCC = JPEG.JCS.getYCC();
if (YCC == null) { // We can't do YCC at all
throw new IIOException("Incompatible color conversion");
}
if ((cs != YCC) &&
(cm.getNumComponents() == numComponents)) {
convert = new ColorConvertOp(YCC, cs, null);
}
}
break;
case JPEG.JCS_YCCA:
{