A project in the company needs to capture PDF thumbnails. Recently, some thumbnails cannot be displayed in IE browser, but they can be displayed in Google Chrome. Finally, it was discovered that the color of the image that could not be displayed was CMKY, and CMKY could not be displayed in the IE browser. Therefore, the image color CMKY needs to be converted to RGB.
About ICC files. The address provided can be downloaded:
CMYK: http://www.mattbeals.com/icc/profiles/cmyk/USWebUncoated.icc.zip RGB:http://www.mattbeals.com/icc/profiles/rgb/AdobeRGB1998.icc.zip
- $im = new Imagick($filename);
- if ($im->getImageColorspace() == Imagick::COLORSPACE_CMYK) {
- $i = new Imagick($filename);
- $profiles = $i ->getImageProfiles('*', false);
- $has_icc_profile = (array_search('icc', $profiles) !== false);
- if ($has_icc_profile === false) {
- $icc_cmyk = file_get_contents(' USWebUncoated.icc');
- $i->profileImage('icc', $icc_cmyk);
- unset($icc_cmyk);
- }
- $icc_rgb = file_get_contents('AdobeRGB1998.icc');
- $i-> profileImage('icc', $icc_rgb);
- unset($icc_rgb);
- $i->writeImage($filename);
- }
Copy code
|