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

Fixed Prevent stripping of ICC color profiles when using ImageMagick

Discussion in 'Resolved 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:
    Code:
    $this->_image->stripImage();
    
    to this:
    Code:
    $profiles = $this->_image->getImageProfiles('icc', true);
    
    $this->_image->stripImage();
    
    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
    eva2000 likes this.
  2. Mike

    Mike XenForo Developer Staff Member

    I've adjusted this now. It's easier to see if you take a ridiculous example: http://cameratico.com/tools/web-browser-color-management-test/ When resizing, the first "image" should come out cyan rather than grey if the ICC profile is kept. In reality, it generally just makes an image appear flatter.

    I'd assume most people who export photos for the web would use sRGB, but clearly that doesn't always happen.
     
    eva2000 and thedude like this.

Share This Page