1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Prevent stripping of ICC color profiles when using ImageMagick

Discussion in 'XenForo Bug Reports' started by thedude, Sep 22, 2016.

  1. thedude

    thedude Well-Known Member

    JPG and other formats can contain ICC color profile data in the EXIF data. Web browsers use this data to render the image with more precise color matching. Without the color profile data, there can be a noticeable difference in the appearance of the picture.

    php's built-in gd library does not support preserving color profiles when resaving, but ImageMagick does!

    If the following part of XenForo_Image_ImageMagick_Pecl:: output() is changed:
    to this:
    $profiles = $this->_image->getImageProfiles('icc', true);
    if (!empty($profiles))
        $this->_image->profileImage('icc', $profiles['icc']);
    then the color profile will be saved and we won't have washed out looking images for some of our important attachments.

    Ref: http://stackoverflow.com/questions/...-exif-from-a-jpg-without-losing-image-quality

    Sample images with icc profiles:
    https://cdn.photographylife.com/wp-content/uploads/2014/07/Adobe-Camera-PROVIA-STANDARD.jpg (via this site)
    http://dev.exiv2.org/attachments/download/820/Reagan.jpg (via this site)
    Last edited: Sep 22, 2016

Share This Page