Hey guys,
I’ve got an issue that I just can’t figure out. I’ve just finished and launched a Kirby site in which I’m resizing pngs with transparent backgrounds, uploaded by the user using the built in resize object. https://getkirby.com/docs/reference/objects/file/resize
This was working fine on our staging server running php 7.1 but when we’ve uploaded the site to the live server (php 7.3) the resized images all have black backgrounds baked in to them. To try and diagnose I’ve changed our staging server to php 7.3 and this has the same affect — black backgrounds start showing up.
Here’s a screenshot of the gd settings on the live server for reference.
The issue was already reported here: Crop Function PNG render Issue. Might have to do with the GD version, see the linked Simpleimage issue. Try switching to ImageMagick if available on your server.
Unfortunately, the TO hasn’t reported if they found a solution.
I have got the same problem since a few weeks. Locally, with Mamp, I have transparent PNGs, but on my Server, I have black backgrounds in my images. I think it happens since Hosteurope changed their PHP version. From what I see GD and IM are installed on my server.
Have you checked which thumb driver is enabled in your config? And also check with phpinfo() if those libraries are also enabled (in case of GD) or if the path to the convert exe is correct in case of ImageMagick.
GD was enabled. I tried to activate IM – which I see is installed on my server – through the config, but Basti said, that the path might be a different one. Trying to re-create all thumbs now anyways. Let’s see … problem right now is, that if I delete my pages folder in media, the images are not created again. Not with IM activated and also not with default settings. Strange.
I am running into the same issue with images from the server, and looking for other ideas to try.
The thumbs driver to ‘im’, and imagemagick + imagick are both installed. I’ve checked the bin convert path on the server is ‘usr/bin/convert’.
But converting transparent PNG to WebP results in black background…
Any further ideas I could try?
Thanks!
Edit: sorry, I forgot to add: I’m using the thumb() function rather than resize…
Edit 2: Turns out, WebP works. The black background was happening when converting to AVIF.