Bug #15726
closedNo 100% transparency/opacity with file.mask
0%
Description
When overlaying images using the file.mask, the colours will always come out wrong.
Example:
Create a GIFBUILDER object with white (#ffffff) background, overlay a 100% green image (gif, #00ff00) with a mask (gif) that is 100% transparent on the left half (#000000) and 100% opaque on right other half (#ffffff). In theory you should get a new image that is #ffffff on the one side and #00ff00 on the other side.
What you get is different, though: The left side will be something like #f9fef9 and the right side #04fe04.
The Reason for this issue is quite trivial:
maskImageOntoImage() in t3lib_stdgraphic uses TYPO3's wrapper function imagecreate() to create all image objects needed in the masking process. If GD2 is used, these images will always come out as true color images. When the images are written to disk, they have to be converted back to 256-color palette images, and this is where the color aberration happens.
Set $truecolor = false and the images come out perfect.
Proposal: If the source files (background, overlay, mask) are 256 color palette images, they should never be converted to truecolor images in the masking process since converting them back will usually return bad colors. The PHP reference for imagetruecolortopalette() admits these problems ("This does not work as well as might be hoped.").
(issue imported from #M2702)
Files