Bug #91274
closedImage composite operations fail with ImageMagick 7
0%
Description
Problem/Description¶
The standard graphical functions class TYPO3\CMS\Core\Imaging\GraphicalFunctions fails to work properly with ImageMagick 7 (current major release) as it uses the outdated option +matte to remove the alpha layer in the output file instead of the more versatile option -alpha. See https://www.imagemagick.org/script/command-line-options.php#alpha for further details.
Affected example¶
- Run a TYPO3 instance with ImageMagick 7
- Navigate to TYPO3 Admin Panel > Environment > Image Processing and run the tests
- Check the test results: 4 tests have failed:
- Combine using a GIF mask with only black and white
- Combine using a JPG mask with graylevels
- Render text with TrueType font using 'niceText' option
- Render 'niceText' with a shadow under
Environment¶
- MariaDB 10.4.12
- Nginx 1.16.1
- PHP 7.3.17
- TYPO3 9.5.16
- ImageMagick 7.0.9-7 Q16 x86_64 2019-12-03
Checking the TYPO3 code base on GitHub this problem should be also reproducable on TYPO3 10.
Fixing the problem¶
I assume this problem can be either resolved by adding a hint in the TYPO3 docs and TYPO3 system tests that it does not support ImageMagick 7 at the moment
— or
by adding a switch to the TYPO3\CMS\Core\Imaging\GraphicalFunctions class which uses +matte or -alpha depending on the ImageMagick version (the history of ImageMagick has to be checked)
— or
by adding some smart switch to the TYPO3\CMS\Core\Imaging\GraphicalFunctions class which checks for the support of the feature +matte and -alpha of the installed ImageMagick/GraphicMagick and uses the one which is available.
Proof of Concept¶
Run the image tests and confirm that the 4 tests mentioned above fail. Replace all occurrences of +matte by -alpha off in TYPO3\CMS\Core\Imaging\GraphicalFunctions, run the image tests again and confirm that all tests succeed.
Greetings
Alex
Files