Legacy Knowledge Base
Published Jul. 2, 2025

The transparent pixel of a PNG image becomes black in preview

Written By

Laura Li

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • When we upload a PNG image with transparency to Documents and Media, the preview image converts the transparent pixel to black.

Environment

  • Liferay DXP 7.0, Liferay DXP 7.1

Resolution

  • This behavior was a limitation by Java vendor. When scaling the image and using java.awt.image.BufferedImage for creating the new image, in case the image has 8-bit color model (the type is TYPE_BYTE_INDEXED), based on the implementation limitation the new color model is losing the alpha and transparency properties. Because it is a limitation by the Java vendor, we are unable to proceed with a fix on the Liferay code.
  • The workaround is to use PNG32 images when dealing with transparent backgrounds.
Did this article resolve your issue ?

Legacy Knowledge Base