Skip to content

Commit

Permalink
[BUGFIX] Re-apply colorspace to resulting image
Browse files Browse the repository at this point in the history
When using filters the colorspace is not always applied.
A quickfix is to add the colorspace-setting again before
writing the output-image.
Multiple colorspace-settings on the commandline will be
executed in order. For example the grayscale-filter uses
"-colorspace GRAY". The final output-image can then be
converted to "-colorspace sRGB" again so the brightness
appears correct (not too dark) again.

Resolves: #78816
Releases: master, 8.7
Change-Id: I3fcabf8fdbb8d43f15662532b881501ebb43b1dd
Reviewed-on: https://review.typo3.org/50791
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
neufeind authored and lolli42 committed Feb 4, 2018
1 parent cecacc9 commit 987a9ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
Expand Up @@ -2121,6 +2121,8 @@ public function imageMagickConvert($imagefile, $newExt = '', $w = '', $h = '', $
$params .= ' -crop ' . $data['origW'] . 'x' . $data['origH'] . '+' . $offsetX . '+' . $offsetY . '! ';
}
$command = $this->scalecmd . ' ' . $info[0] . 'x' . $info[1] . '! ' . $params . ' ';
// re-apply colorspace-setting for the resulting image so colors don't appear to dark (sRGB instead of RGB)
$command .= ' -colorspace ' . $this->colorspace;
$cropscale = $data['crs'] ? 'crs-V' . $data['cropV'] . 'H' . $data['cropH'] : '';
if ($this->alternativeOutputKey) {
$theOutputName = GeneralUtility::shortMD5($command . $cropscale . basename($imagefile) . $this->alternativeOutputKey . '[' . $frame . ']');
Expand Down

0 comments on commit 987a9ea

Please sign in to comment.