Contentful logo

Contentful Community

Converted images suddenly show black bg color

Hi there,

We’re using the images API to convert SVG images to progressive JPGs. Starting a few days ago, some of our images show a black instead of a white background. I assume that the source images are transparent and maybe the default background color was changed from white to black in Contentful? I’ve tried to add bg=rgb:ffffff to the URL, but the background color still comes out black instead of white…

Example URL without bg attribute: https://images.ctfassets.net/.../image.svg?fm=jpg&fl=progressive&fit=pad&w=150&h=150

And with the attribute: https://images.ctfassets.net/.../image.svg?fm=jpg&fl=progressive&fit=pad&w=150&h=150&bg=rgb:ffffff

Is this a bug?

Thanks,
Patrick

1 Like

This is definitely a bug with the Images API.

It happens when the original image is an SVG with a transparent background and you request that resource as a .jpg.

Requesting the resources as a .png does not cause the same problem.

I hope the Contentful devs can take a look at this soon.