Issue Bug Closed

#91855Image with crop set is JPEG compressed twice

Christian Toffolo 07/23/20, 20:39 updated 07/09/24, 12:00

Description

Image with crop set is JPEG compressed twice so it loses quality 2 times based on jpg_quality setting.

1st compress when crop is executed: https://github.com/TYPO3/TYPO3.CMS/blob/5275e76e4ae7e00a0bce59b8d458e547e427b92b/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php#L87
2nd compress when scaling is executed:
https://github.com/TYPO3/TYPO3.CMS/blob/5275e76e4ae7e00a0bce59b8d458e547e427b92b/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php#L118

A solution could be to use a $jpegQuality=100 the first time it’s compressed if it will be compressed a second time (using the configured jpg_quality).

Reviews 6