我有一张带嵌入式颜色配置文件的JPEG图片。一些网络浏览器会显示应用了颜色配置文件的图片,而另一些则不会。如何将颜色配置文件应用于图片并删除该配置文件,以便所有浏览器都可以显示相同的图片?
我尝试使用ImageMagick扩展来解决问题,但是在不同的浏览器中,图片仍然显示不同:
function add_color_profiles($source_path, $target_path){
$all_exts = get_loaded_extensions();
if(!in_array('imagick',$all_exts))
return true;
$im1 = new Imagick($source_path);
$im2 = new Imagick($target_path);
$profiles = $im1->getImageProfiles();
if(!$profiles)
return true;
foreach($profiles as $name => $profile){
$im2->setImageProfile($name,$profile);
}
$im2->writeImage ($target_path);
return true;
}