Steffen
Well-known member
- Affected version
- 2.0.2
I've stumbled upon a PNG avatar whose transparency is not preserved by XenForo. Most other avatars don't have this problem.
I've attached an avatar whose transparency is preserved (good.png) and an avatar whose transparency is not preserved. The following code essentially does the same thing as XF\Image\Gd and can be used to reproduce the problem.
If I remove the
Maybe the issue exists on files where
I've attached an avatar whose transparency is preserved (good.png) and an avatar whose transparency is not preserved. The following code essentially does the same thing as XF\Image\Gd and can be used to reproduce the problem.
PHP:
<?php
$image = imagecreatefrompng($argv[1]);
imagealphablending($image, false);
imagesavealpha($image, true);
imagepng($image, $argv[2]);
Bash:
php image.php bad.png out.png
If I remove the
imagealphablending
and imagesavealpha
calls then "bad.png" works fine but "good.png" fails. Maybe these calls should happen depending on some property of the input file. But I have not found out what property that is.Maybe the issue exists on files where
identify -verbose <file.png>
reports "Type: TrueColorAlpha" instead of "Type: PaletteAlpha".