Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Steps to reproduce:

  1. Create a PNG-8 with a transparent background.
  2. Upload to WordPress 3.3.1.
  3. View original PNG in any browser, Chrome, Firefox, IE, etc. Notice that it retains transparency as it should.
  4. View a resized version of that PNG in any browser. Observe that the transparent portions of the PNG are now black.

Examples:

This occurs even with a clean install of WordPress 3.3.1 with no plugins activated. Any ideas on what might be causing this bug? I've been searching all over this forum, the WordPress support forums, and anywhere else Google can find. All I see out there are mentions of a NextGEN Gallery plugin bug and the infamous IE6 PNG transparency bug, neither of which appear to pertain to this problem.

Thanks in advance.

share|improve this question
    
See also core.trac.wordpress.org/ticket/20555 –  toscho May 1 '12 at 10:11
add comment

3 Answers

up vote 4 down vote accepted

I'd try saving it as a PNG 24 first.

If that doesn't work have a look at these:

http://www.akemapa.com/2008/07/10/php-gd-resize-transparent-image-png-gif/

http://stackoverflow.com/questions/6382448/png-transparency-resize-with-simpleimage-php-class

share|improve this answer
    
Saving the image as a PNG 24 worked like a charm. I'll look into the StackOverflow solution next. Thanks for your help! –  Mike Lee Feb 1 '12 at 23:02
    
My pleasure. Glad it was a simple fix! –  fxfuture Feb 2 '12 at 3:53
add comment

I can save you hours searching on the internet to solve this problem. Make sure you do this when adding a PNG to WordPress

png must be png 24 bit If you are adding a logo to your WordPress site make sure the size of the logo is the exact size of what is already there. If the size of the png is too big it makes the transparent background go black.

share|improve this answer
add comment

Wordpress 3.5 introduces WP_Image_editor, allowing use of either GD or Imagemagick, and apparently installing and using the PHP Imagemagick library is the solution to black transparency when resizing GIF files (or PNGs): http://lists.automattic.com/pipermail/wp-hackers/2014-January/047573.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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