1

Either I'm missing something (or have something badly configured in my self-hosted blog network) or when I'm uploading a transparent .png file (with alpha channel) using Media Library, my Wordpress installation makes all possible cropped versions loosing transparency.

This way, when I'm picking a perfectly transparent image for my site icon, I end up with favicons having ugly looking white background. To make things even worse, Wordpress' Media Library uses some weird size reduction algorithm, which causes my perfectly white / transparent background to be composite with all different shades of white / gray on all cropped images.

Is there any way to workaround this problem? Is this something in my configuration or is this another bug (loosing transparency / alpha channel when resizing image couldn't be a feature).

The only way I found to workaround this, is to download all cropped image files (after upload) through FTP, manually correct them (add transparency or fix background color) and re-upload them back, overwriting files generated by Wordpress. But, that sounds like a madness...

2
  • Does this only happens for site icons or do you see the same thing happening when you upload a transparent png file through the media library? It worked for me few days ago with such a file.
    – birgire
    Sep 8, 2015 at 13:37
  • @birgire No. As I stated in the first line of my question: "(...) when I'm uploading a transparent .png file (with alpha channel) using Media Library (...)" -- that means, that this happens always, no matter what destination for uploaded image is.
    – trejder
    Sep 8, 2015 at 18:44

1 Answer 1

4

There used to be an issue with WordPress – but that should have been fixed 5 years ago: Preserve PNG transparency/alpha during thumbnail creation

If you're using a newer WP installation (which I suppose) this issue might be rather a problem with the GD library of your server than with WordPress. And as far as I know this issues only occurs with 8bit pngs. Using 24bit pngs you should be on the safe side.

I found this 'suggestion' over at the wordpress support forum. However I can not confirm this 'bug-fix' myself since my webserver seems to render both 8 bit and 24 bit images just fine (tested here with WP 4.3, GD bundled 2.1.0 compatible, PHP Version 5.3).

1
  • You have most certainly hit the point with that 8-bit .png file, which I was making somewhat automatically from 24-bit source files. Without conversion to 8-bit and with uploading 24-bit file through Media Library, everything seems fine about alpha channel and transparency. Thank you...
    – trejder
    Sep 8, 2015 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.