对图像应用内置的颜色配置文件

时间:2022-08-15 21:15:17

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.

我有一张嵌入颜色轮廓的jpeg图片。一些web浏览器显示应用的概要文件,有些则不是。如何将颜色配置文件应用于图像和删除配置文件,使所有浏览器的图像显示一致。

I tried solve problem by image magick extension, but image still show different in different browsers:

我尝试通过图像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;
    }

1 个解决方案

#1


3  

Apply profile to an image (convert image colorspace to RGB):

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

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

Strip profile information from an output file:

从输出文件中删除概要信息:

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

Strip an image of all profiles, exif (comments GPS data etc.):

删除所有配置文件的图像,exif(评论GPS数据等):

$im->stripImage();

#1


3  

Apply profile to an image (convert image colorspace to RGB):

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

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

Strip profile information from an output file:

从输出文件中删除概要信息:

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

Strip an image of all profiles, exif (comments GPS data etc.):

删除所有配置文件的图像,exif(评论GPS数据等):

$im->stripImage();