将内置颜色配置文件应用于图像 [英] Apply built-in color profile to image
本文介绍了将内置颜色配置文件应用于图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张嵌入颜色配置文件的JPEG图片。一些Web浏览器显示带有应用配置文件的图像,有些则没有。如何将颜色配置文件应用于图像和删除配置文件,所有浏览器都显示相同的图像。
I have one JPEG-picture with embeded color profile. Some web-browsers show image with applied profile, some not. How to apply color profile to image and delete profile, that all browsers display image identically.
我尝试通过图像magick扩展解决问题,但图像在不同的浏览器中仍然显示不同:
I tried solve problem by image magick extension, but image still show different in different browsers:
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;
}
推荐答案
将资料应用于图像(将图像色彩空间转换为RGB):
Apply profile to an image (convert image colorspace to RGB):
$im->setImageColorspace(IMagick::COLORSPACE_RGB);
从输出文件中删除个人资料信息:
Strip profile information from an output file:
$im->profileImage('*', NULL);
删除所有配置文件的图像,exif(评论GPS数据等):
Strip an image of all profiles, exif (comments GPS data etc.):
$im->stripImage();
这篇关于将内置颜色配置文件应用于图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文