Support » Fixing WordPress » [Plugin: NextGEN Gallery] How to change black background in image with transparency?

  • Hello,

    Could anyone please tell how can thumbnails of images with transparencies be displayed with white background instead of black one?

    I have tried modifying gallery style, but to no avail. And adding background to images in an image editor is not an option, as pictures need to have transparencies.

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I just noticed that it is not a styling issue, it is how transparency is being handled by the core during resizing, because resized thumbnail files have black background themselves.

    Could anyone please direct me what needs to be changed in the core to keep transparency or make it white?

    I guess to fix this problem, some function needs to be added to file.

    Have found an article, with code sample, that discusses this problem – PHP-GD: Resize Transparent Image PNG & GIF.

    It says that: “By default, you will get black background if you resize a transparent image. To fix it, you need set alpha channel imagecolorallocatealpha to 127.”

    Though I am not sure how to do it myself.

    Iam in the same way that you, but the problem its in the core or in the AJAX thumbnail generation?

    I am having the same issue. Does anyone have specific steps on how to put the above remedy in place?

    Is PHP GD part of WordPress? Or part of something outside WP? If it is something that I cannot touch without access to the web server, I don’t think I can touch it. My site is hosted on

    Ester and Kochfede:

    I found some good news, at least as far as PNG files are concerned. I noticed something, had a hunch, and did some testing.

    If you use PNG instead of GIF, and make sure the PNG image (with transparency) is saved in 24-bit mode, when you upload it you will not see black backgrounds.

    The black background issue only affects images with transparency that are stored in less than 24 bits of color depth (i.e. 8-bit images).

    Since GIF format only allows a limited 8-bit color palette, the problem will regularly affect GIFs with transparency.

    However, PNG files can be stored in either 8-bit or 24-bit. (24-bit depth allows 8 bits for red channel, 8 bits for green channel, 8 bits for blue channel, and 8 bits for the transparency channel.)

    Use 24-bit PNG images and you will get to have both transparency and nice looking thumbnails.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: NextGEN Gallery] How to change black background in image with transparency?’ is closed to new replies.