Converting a CMYK to RGB with reasonable colors

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Chris Riesen

Converting a CMYK to RGB with reasonable colors

Post by Chris Riesen »

Someone might have stumbled across this as well, and to save you the trouble I just had, here a short overview of how the solution looks like that finally resulted in the wanted output:

Code: Select all

if ((MagickGetImageProfile ($this->_mw, "IPTC") == "") || (MagickGetImageProfile ($this->_mw, "ICC") == "")) { 
	MagickSetImageProfile($this->_mw, "ICC", file_get_contents('USWebCoatedSWOP.icc')); // CMYK profile

// Add profile to image (RGB)
MagickProfileImage($this->_mw, "ICC", file_get_contents('AdobeRGB1998.icc')); // RGB profile
$this->_mw is the magickwand used here for the image, so replace this with whatever you use. The files are in the same folder as this script running. After this code, the image will be RGB, no matter if it was CMYK or RGB before.

Important is also to use SetImageProfile in the upper part and just ProflieImage in the lower part or it will not work!

The icc files are from, you can find the fast with Google when you search for "Adobe ICC Profiles". I downloaded the end user ones and from there it should be pretty straight forward which ones to pick.