← All tools
Flatten alpha
Imageimage.flatten
in: imageout: image
Remove alpha channel; fill transparent areas with background colour.
Pricing
- Price
- 0.125 cr / request
Prices in credits (1 credit = $0.01).
Flatten Alpha
Remove the alpha (transparency) channel from an image, filling transparent areas with a solid background colour.
When to use
- Prepare for JPEG output — JPEG does not support transparency; flatten before converting format.
- Consistent rendering — ensure transparent PNGs display a predictable background in all viewers.
- Reduce file size — images without alpha compress more efficiently in JPEG/WebP lossy mode.
Inputs & outputs
| Input modality | Image file (URL) |
| Output modality | Image file (GCS URL) |
| Max input size | 50 MB |
| Supported formats | PNG, WebP, TIFF, AVIF (any format with alpha) |
Parameters
| Param | Required | Description |
|---|---|---|
background | no | Hex colour to use for transparent areas (default #ffffff). Accepts 6-digit (#rrggbb) or 8-digit (#rrggbbaa) hex. |
Examples
Flatten to white background
{
"type": "image.flatten",
"input": { "image_url": "gs://infery-prod-media/assets/logo-transparent.png" },
"params": { "background": "#ffffff" }
}
Flatten to dark background for dark-mode export
{
"type": "image.flatten",
"input": { "image_url": "gs://infery-prod-media/icons/icon.png" },
"params": { "background": "#1a1a2e" }
}
Pricing
Billed per megapixel of output image. See pricing dashboard for current rates.
Related capabilities
image.convert_format— convert to JPEG after flattening (JPEG requires no alpha)image.add_alpha_channel— inverse operation: add alpha to an opaque imageimage.pipeline— chain flatten with other ops in a single execution
Examples
White background
{
"background": "#ffffff"
}