note 82852 added to function.imagick-profileimage

From: Date: Tue, 29 Apr 2008 14:01:21 +0000
Subject: note 82852 added to function.imagick-profileimage
Groups: php.notes 
Request: Send a blank email to php-notes+get-138897@lists.php.net to get a copy of this message
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"); // load image $profiles = $image->getImageProfiles('*', false); // get profiles $has_icc_profile = (array_search('icc', $profiles) !== false); // we're interested if ICC profile(s) exist if ($has_icc_profile === false) { // image does not have CMYK ICC profile, we add one $icc_cmyk = file_get_contents('/path/to/icc/SomeCMYKProfile.icc'); $image->profileImage('icc', $icc_cmyk); } // Then we need to add RGB profile $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. ---- Server IP: 62.237.7.3 Probable Submitter: 83.145.215.158 ---- Manual Page -- http://www.php.net/manual/en/function.imagick-profileimage.php Edit -- https://master.php.net/note/edit/82852 Del: integrated -- https://master.php.net/note/delete/82852/integrated Del: useless -- https://master.php.net/note/delete/82852/useless Del: bad code -- https://master.php.net/note/delete/82852/bad+code Del: spam -- https://master.php.net/note/delete/82852/spam Del: non-english -- https://master.php.net/note/delete/82852/non-english Del: in docs -- https://master.php.net/note/delete/82852/in+docs Del: other reasons-- https://master.php.net/note/delete/82852 Reject -- https://master.php.net/note/reject/82852 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138897) next »