Color space in Typo3 4.7 with Image magic 6.7.5 or higher

If we are using the tyop3 version 4.7 or less and the Image magic is upgraded to the latest version (>= 6.7.5)
then we need to set the colorspace to sRGB in install tool and need to patch the core file to make it work properly.

Find the file ‘class.t3lib_stdgraphic.php‘ in t3lib.
add the following lines in order

add
protected $IMversion = 0; // ImageMagick Version
after the line
var $nativeCharset = ”; // Is set to the native character set of the input strings.

in similar way

add
else {
$cmd = t3lib_div::imageMagickCommand(‘identify’,’-version | grep Version:’);
$ret = explode(‘ ‘,t3lib_utility_Command::exec($cmd));
$ret = explode(‘.’,str_replace(‘-‘,’.’,$ret[2]));
$this->IMversion = $ret[0].str_pad($ret[1],4,’0′,STR_PAD_LEFT).str_pad($ret[2],4,’0′,STR_PAD_LEFT).str_pad($ret[3],4,’0′,STR_PAD_LEFT);
}
after
if (!$gfxConf[‘im’]) {
$this->NO_IMAGE_MAGICK = 1;
}

Replace the line
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace RGB -sharpen 50 -quality ‘ . $this->jpegQuality;
after
$this->jpegQuality = t3lib_utility_Math::forceIntegerInRange($gfxConf[‘jpg_quality’], 10, 100, 75);
with
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace ‘ . ( $this->IMversion >= 6000700050005 ? ‘s’ : ” ) . ‘RGB -sharpen 50 -quality ‘ . $this->jpegQuality;

Replace the line
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace RGB -quality ‘ . $this->jpegQuality;
after
$this->NO_IM_EFFECTS = 1;
with
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace ‘ . ( $this->IMversion >= 6000700050005 ? ‘s’ : ” ) . ‘RGB -quality ‘ . $this->jpegQuality;
Replace the line
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace RGB -quality ‘ . intval($gfxConf[‘jpg_quality’]) . $this->v5_sharpen(10);
after
$this->V5_EFFECTS = 1;
if ($gfxConf[‘im_v5effects’] > 0) {
with
$this->cmds[‘jpg’] = $this->cmds[‘jpeg’] = ‘-colorspace ‘ . ( $this->IMversion >= 6000700050005 ? ‘s’ : ” ) . ‘RGB -quality ‘ . intval($gfxConf[‘jpg_quality’]) . $this->v5_sharpen(10);