51黑料不打烊

How to serve images with tranparent background from Dynamic Media

Can Dynamic Media serve images with a transparent background?

Description description

Description : Even when uploading an image in png format with a transparent background, serving that image from Dynamic Media results in a white background. How can we maintain transparency?

Resolution resolution

The default output format for images is jpeg which does not support transparency. Even with SmartImaging turned on, where the image gets converted into webp or avif, since jpeg does not support transparency, the webp or avif it is converted into won鈥檛 have transparency either.

The way to make sure that the response image has transparency is to explicitly request an image format with an alpha channel, e.g. by adding fmt=png-alpha, fmt=png8-alpha, or fmt=gif-alpha. That will make sure the transparency is maintained, also when the image is converted into webp or avif using SmartImaging.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f