If you need to convert images that are on CMYK format into RGB and want to preserve colour information, this may be helpful:
<?php
$image = new Imagick("CMYK_image.jpg"); $profiles = $image->getImageProfiles('*', false); $has_icc_profile = (array_search('icc', $profiles) !== false); if ($has_icc_profile === false)
{
$icc_cmyk = file_get_contents('/path/to/icc/SomeCMYKProfile.icc');
$image->profileImage('icc', $icc_cmyk);
}
$icc_rgb = file_get_contents('/path/to/icc/SomeRGBProfile.icc');
$image->profileImage('icc', $icc_rgb);
$image->setImageColorSpace(Imagick::COLORSPACE_RGB);
$image->writeImage("RGB_image.jpg");
?>
There may be better and more elegant ways to do this, but hope this helped.