MagickCompositeImage and colorspaces
Posted: 2015-04-04T08:12:38-07:00
When using MagickCompositeImage to composite an image in CMYK colorspace into an image in RGB colorspace, the image being composited does not appear to be converted to the correct colorspace before being composited.
The example code was reported in PHP, I can convert this to C if required.
This produces the image:
Where the map has been composited as CMYK, but the background image is in RGB space. This was tested with ImageMagick 6.9.0-7
This can worked around by explicitly converting the image that is going to be composited to the RGB colorspace. I would have expected this to happen automatically.
Source image if required is here:
https://cloud.githubusercontent.com/ass ... db4404.jpg
The example code was reported in PHP, I can convert this to C if required.
Code: Select all
$img=new Imagick();
$img->newImage(700,700,new ImagickPixel('#f0f')); //Calls MagickNewImage(magickwand, 700, 700, color_wand)
$pic=new Imagick('im.jpg'); //This image is in CMYK
$pic->thumbnailImage(500,500);
$img->compositeImage($pic,imagick::COMPOSITE_DEFAULT,100,100);
$img->writeImage("worldMapOutput_cmyk.jpg");
This produces the image:
Where the map has been composited as CMYK, but the background image is in RGB space. This was tested with ImageMagick 6.9.0-7
This can worked around by explicitly converting the image that is going to be composited to the RGB colorspace. I would have expected this to happen automatically.
Source image if required is here:
https://cloud.githubusercontent.com/ass ... db4404.jpg