1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-11 02:24:15 +02:00

Added conversion to sRGB using option ?srgb. #120.

This commit is contained in:
Mikael Roos
2015-10-24 15:43:56 +02:00
parent aedce7021f
commit 7a98a44dd4
7 changed files with 38 additions and 15 deletions

View File

@@ -2404,12 +2404,13 @@ class CImage
* @param string $src of image.
* @param string $dir as base directory where images are.
* @param string $cache as base directory where to store images.
* @param string $iccFile filename of colorprofile.
* @param boolean $useCache or not, default to always use cache.
*
* @return string | boolean false if no conversion else the converted
* filename.
*/
public function convert2sRGBColorSpace($src, $dir, $cache, $useCache = true)
public function convert2sRGBColorSpace($src, $dir, $cache, $iccFile, $useCache = true)
{
if ($this->verbose) {
$this->log("# Converting image to sRGB colorspace.");
@@ -2450,10 +2451,8 @@ class CImage
if ($colorspace != Imagick::COLORSPACE_SRGB || $hasICCProfile) {
$this->log(" Converting to sRGB.");
/*
$icc_rgb = file_get_contents('/path/to/icc/SomeRGBProfile.icc');
$image->profileImage('icc', $icc_rgb);
*/
$sRGBicc = file_get_contents($iccFile);
$image->profileImage('icc', $sRGBicc);
$image->transformImageColorspace(Imagick::COLORSPACE_SRGB);
$image->writeImage($this->cacheFileName);