In the release notes from October, you have:
In our case, we load a RGB JPEG file. Then we assign the ICC Colorprofile with CMYK and the image is converted. Then when we write new JPEG file, we have a RGB JPEG file with CMYK profile.
We see in the debug messages:
12:15:28 0:0.341048 0.340u 5499 jpeg.c/WriteJPEGImage/2836/Coder: Write JPEG Image: image->orientation = 0
12:15:28 0:0.341051 0.340u 5499 jpeg.c/WriteJPEGImage/2867/Coder: Transforming colorspace from CMYK to RGB
12:15:28 0:0.341053 0.340u 5499 colorspace.c/TransformRGBImage/1450/Transform: Transform colorspace from CMYK to RGB
In noticed that image->colorspace() is CMYK with value 10, but imageinfo->colorspace is still zero for UndefinedColorspace. Seems like RGBTransformImage doesn't update the imageinfo->colorspace.
So this code in the jpeg writer causes conversion to RGB:
if (((UndefinedColorspace == image_info->colorspace) &&
(!IsRGBCompatibleColorspace(image->colorspace))) ||
((IsRGBCompatibleColorspace(image->colorspace) &&
!IsRGBColorspace(image->colorspace))))
{
if (image->logging)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Transforming colorspace from %s to RGB",
ColorspaceTypeToString(image->colorspace));
(void) TransformColorspace(image,RGBColorspace);
}
This may need some update to let both grayscale and CMYK images pass through.
I fix it now by manually setting image_info->colorspace to image->colorspace before saving.