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!
cmb
Posts: 11880
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Images with embedded color profiles

Postby 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, but not for CMSimple 4+

Return to “Open Development”

Who is online

Users browsing this forum: No registered users and 1 guest