Convert to sRGB color space
This is how you can deal with images not being pure sRGB images.
PHP GD operates on pure sRGB color space. This makes it troublesome to deal with images that is not in sRGB color space. Since PHP GD ignores the extra information on color profile, the images usually end up looking dull, missing the vibrant colors from the original image.
The PHP extension imagick needs to be installed to support this.
Or just save all your originals using the sRGB colorspace and this will not be an issue.
#Problem with PHP GD and color profiles
Lets take a hamburger that is saved having the colorspace of Adobe RGB (1998) which has a larger range of colors than the more common (for web usage) sRGB.
Lets review the same issue using a yellow car which has the color profile “Color LCD”.
In general this should not be to much problem, just save all your original images as sRGB and your home safe.
#Always convert to sRGB by configuration
You can decide to always use the option
srgb, for all images, by turning this on in the config file.
The default section from the config file looks like this.
* Convert the image to sRGB before processing. Saves the converted
* image in a cache subdir 'srgb'. This option is default false but can
* be changed to default true to always do conversion for all images.
* This option requires PHP extension imagick and will silently fail
* if that is not installed.
* Default value:
* srgb_default: false
* srgb_colorprofile: __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc'
//'srgb_default' => false,
//'srgb_colorprofile' => __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc',
Note that CImage needs the path to the color profile to work, change this if needed.