Images with embedded color profiles

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Images with embedded color profiles

Post by cmb » Sat Sep 30, 2017 1:56 pm

Hi everybody!

Several plugins resize images on the server for different reasons (some create thumbnails, some may do this for privacy reasons to remove embedded info). This usually works fine as long as there are no embedded ICC color profiles, which are ignored by GD (at least for JPEG and PNG images). This may result in "washed-out" images, i.e. more faint colors then expected.

I don't think this can be fixed with a reasonable amount of work, but we should consider to check for embedded ICC profiles when images are uploaded via the default filebrowser, and warn users if that is the case. If they get the warning, they still may consider to convert the images to sRGB color space by other means, and upload the image again.

The code to check for embedded color profiles in JPEG images (which are probably most relevant in this regard) might according to http://dev.exiv2.org/projects/exiv2/wik ... les#24-ICC be as simple as:

Code: Select all

getimagesize($imagefile, $info);
if (isset($info['APP2']) && strpos($info['APP2'], "ICC_PROFILE\0") === 0) {
    // warn
} 
Thoughts?
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Images with embedded color profiles

Post by cmb » Mon Nov 27, 2017 7:15 pm

cmb wrote:Thoughts?
After reconsideration I think it is best to change nothing in the Filebrowser. After all, the uploaded images may never be resized, and plugins that do resize images would have to cater to the issue anyway, because the images may have been uploaded by another file browser or via FTP.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply