Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply built-in color profile to image

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.

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;
    }
like image 538
denisoid Avatar asked Feb 01 '13 12:02

denisoid


People also ask

How do you apply or convert a color profile to an image?

Apply a color profile to the image: Choose Tools > Assign Profile, select a color profile, then click OK. See what an image would look like on a different device: Choose View > Soft Proof with Profile, then select a color profile.

Can you embed color profile in PNG?

Photoshop can embed profiles in PNG just make sure that you don't save the PNG using the "Save for Web..." feature (which incidentally also strips color profiles from your JPEGs too). Use "Save As..." to save for PNG and it will embed the color profile.

How do I add a color profile to GIMP?

You can access this command from the image menu bar through Image → Color Management → Assign Color Profile.


1 Answers

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);

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

$im->stripImage();
like image 142
clover Avatar answered Oct 28 '22 13:10

clover