Dynamic Media - PNG image with transparent background - Served with white | Community
Skip to main content
Level 3
Jun 1, 2022 12:14 PM UTC
Solved

Dynamic Media - PNG image with transparent background - Served with white

Hello Team,

We are using dynamic media in our project. and we are exploring DM. I am facing one issue that is we have uploaded image with transparent background on AEM DAM. But when it served from DM, getting white background. 

 

I tried adding manually fmt=png-alpha to remove white background. But not sure how to get this dynamically append as query param for all png images. OR is there a better way to handle white background ?. Also not sure whether its an issue in the DM product where it converts transparent background image to white background image?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Jun 1, 2022 2:54 PM UTC

I am getting the image but with the white background 


Probably then you need to add this param along with bfc and fmt

fmt=png-alpha&bfc=on

You can update the existing component or use sling rewriter to get the images and update the url while generating url

e.g. https://github.com/arunpatidar02/aem63app-repo/blob/master/java/CustomLinkChecker.java  

 

Arun Patidar

8 replies

Level 3
Jun 17, 2022 9:26 AM UTC

Resolved by extending image preset selection option to teaser component and preset setup configured with png-alpha. 

Translate
Fanindra_Surat
New Participant
Jun 1, 2022 1:50 PM UTC

Hi @pradeepmoolemane - Good Job, you have rightly identified the solution to rendering the transparent images by using fmt=png-alpha. Now, there are multiple solutions to apply this formatting for all the pngs but the simplest could be to have a utility that detects the DAM image extension and renders a corresponding DM URL with the fmt option suffixed and use it in all the components leveraging DM images.

Let me know, if you have any other questions!

Translate
Employee
Jun 1, 2022 1:14 PM UTC

Hi @pradeepmoolemane ,

 

Please go through below URL

https://blogs.perficient.com/2019/03/07/aem-6-4-challenges-with-dynamic-media-scene7-integration/

 

You can add format.

 

Hope this helps!!

Thanks

Translate
arunpatidar
New Participant
Jun 1, 2022 12:53 PM UTC

Hi,

Is this in Safari or Chrome browser?

 

I have seen this issue with monochromatic image only in Safari.DM returns 403 instead of actual image.

Translate
Arun Patidar
Level 3
Jun 1, 2022 1:08 PM UTC

Hi @arunpatidar this is happening all browsers, tested on chrome, safari, firefox.

Translate
arunpatidar
New Participant
Jun 1, 2022 1:18 PM UTC

What response do you get from DM? Error or white image?

Translate
Arun Patidar