应用内置色彩配置文件到图像

6

我有一张带嵌入式颜色配置文件的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;
    }
1个回答

3

将配置文件应用于图像(将图像色彩空间转换为RGB):

$im->setImageColorspace(IMagick::COLORSPACE_RGB);

从输出文件中删除配置文件信息:

$im->profileImage('*', NULL);

去除图像中的所有配置文件、exif(注释GPS数据等):

$im->stripImage();

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接