Until now I use the commandline convert in my PHP script:
Code: Select all
convert 'anyRGBfile.jpg' -profile '$sRGBprofil' 'sRGBfile.jpg'
Now I tried to do the same thing using the Imagick class - without success:
Code: Select all
$source='Desert-eci-rgb.jpg';
$sRGBprofil="sRGB_IEC61966-2-1.icc";
$image=new Imagick($source);
$profiles = $image->getImageProfiles('*', false); // get profiles
$has_icc_profile = (array_search('icc', $profiles) !== false);
if ($has_icc_profile === false)
{
// image does not have a ICC profile, we add one
$icc_in = file_get_contents('$sRGBprofil');
$image->profileImage('icc', $icc_in);
}
// Destination rgb profile
$icc_out = file_get_contents('$sRGBprofil');
$image->profileImage('icc', $icc_out);
header( "Content-Type: image/jpeg" );
echo $image;
Can anyone give me a hint, please?
Thanks in advance