legacy-knowledge-base
公開されました Jul. 2, 2025

PNG画像の透明画素がプレビューで黒くなる件

written-by

Laura Li

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

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

legacy-article

learn-legacy-article-disclaimer-text

問題

  • 透明度のあるPNG画像をDocuments and Mediaにアップロードすると、プレビュー画像で透明ピクセルを黒に変換してしまう。

環境

  • Liferay DXP 7.0、Liferay DXP 7.1

解決策

  • この動作は、Javaベンダーの制限によるものです。 画像を拡大縮小し、java.awt.image.BufferedImageを使用して新しい画像を作成する場合、画像が8ビットカラーモデル(タイプはTYPE_BYTE_INDEXED)である場合、実装制限に基づいて、新しいカラーモデルはアルファと透明度の特性を失っています。 Javaベンダーによる制限であるため、Liferayのコードに対する修正を進めることができません。
  • 回避策としては、透明な背景を扱う場合はPNG32画像を使用することです。
did-this-article-resolve-your-issue

legacy-knowledge-base