Page 1 of 1

MagickCompositeImage and colorspaces

Posted: 2015-04-04T08:12:38-07:00
by Danack
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.

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

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: ... db4404.jpg

Re: MagickCompositeImage and colorspaces

Posted: 2015-04-04T08:20:04-07:00
by magick
The ImageMagick design philosophy is do what the user wants-- not what we think the user wants. The command-line makes some exceptions, but for the various API's, we assume the developer knows what they are doing, and if they want to composite an RGB image over an CMYK image, that's ok.