将内置颜色配置文件应用于图像

den*_*oid 6 php jpeg imagemagick image-processing color-profile

我有一个嵌入颜色配置文件的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)

clo*_*ver 3

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

$im->setImageColorspace(IMagick::COLORSPACE_RGB);
Run Code Online (Sandbox Code Playgroud)

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

$im->profileImage('*', NULL);
Run Code Online (Sandbox Code Playgroud)

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

$im->stripImage();
Run Code Online (Sandbox Code Playgroud)