Skip to content

Issue: renderStill() with webp has solid white background due to hardcoded omitBackground. #6912

@JonnyBurger

Description

@JonnyBurger

From message posted on Discord by nandushaji

<@701030996430159872> Following up on this! I was testing renderStill() with imageFormat: 'webp' expecting it to be transparent based on your message, but it was coming out with a solid white background.
I dug into the @remotion/renderer source code to see why, and it looks like the omitBackground flag passed to Puppeteer is strictly hardcoded to only be true for PNGs.
In packages/renderer/src/take-frame.ts (and screenshot-dom-element.ts), I found this:

const buf = await screenshot({ page: freePage, omitBackground: imageFormat === 'png', // <-- This forces false for 'webp' path: (wantsBuffer ? undefined : output) ?? undefined, type: imageFormat, // ... });

Because of imageFormat === 'png', when I pass imageFormat: 'webp', omitBackground evaluates to false. As a result, Puppeteer never sends the Emulation.setDefaultBackgroundColorOverride command to CDP, and Chrome paints a solid white background before capturing the WebP.

Metadata

Metadata

Labels

filed by customerThe problem affects a company license holder

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions