我有一个嵌入颜色配置文件的JPEG图片.一些Web浏览器显示带有应用配置文件的图像,有些则没有.如何将颜色配置文件应用于图像和删除配置文件,所有浏览器都显示相同的图像.
我尝试通过图像magick扩展解决问题,但图像在不同的浏览器中仍然显示不同:
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;
}
Run Code Online (Sandbox Code Playgroud)