Imgix APIsRendering APITextText Blend Mode

Text Blend Mode

txt-blend-mode

Uses a text layer as a knockout shape rather than drawing it onto the image. Instead of painting letters on top, the letterforms become a transparent hole — the classic cut-out headline, where the page or a background layer shows through the type.

Use txt-blend-mode[N] to apply a knockout to a specific text layer.

Accepted Values

ValueResult
destination-outThe image is removed where the text is. The letters become transparent holes.
destination-inOnly the area covered by the text survives. Everything outside the letterforms is removed.

Only the knockout modes apply

txt-blend-mode is a knockout mechanism, not a general blending control. The CSS blend modes accepted by blend-mode — multiply, screen, overlay and the rest — render identically to omitting the parameter.

What forms the cutting shape

The shape is the text layer exactly as it would have been drawn: the glyphs, their outline (txt-line), their shadow (txt-shad), the txt-bg box, rotation and txt-alpha. Size, alignment, wrapping and padding place it where the drawn text would sit.

A knockout layer is not also drawn normally — it is consumed as the cutting shape, so txt-color has no visible effect. Colors are never drawn, but their transparency counts: a half-transparent txt-bg cuts half.

destination-out removes everything drawn before the text — the image, its padding and border, watermarks, and text layers with a lower index. Later text layers and drop-shadow draw over the hole, with the shadow falling along the cut’s edges. destination-in keeps only what lies inside the text and removes the rest of the canvas. Animations are cut on every frame.

A layer with nothing to draw — only whitespace and no txt-bg, an empty wrap box, txt-alpha=0, or a fully transparent color — follows Porter-Duff: destination-out removes nothing, while destination-in keeps nothing, making the whole canvas the hole.

Filling the transparency

The hole takes bg when you set one, on any format. Without it:

  • on a format that carries transparency (PNG, WebP, AVIF) the hole is transparent;
  • on JPEG and GIF it is filled with white;
  • with auto=compress and no fm, a JPEG source keeps the hole transparent and is delivered as PNG. fm=jpg always fills it.

transparency=grid paints after a text cut, so the checkerboard shows through the hole.

Demo

Each example adds transparency=grid so the checkerboard makes the hole visible. It is not required to use txt-blend-mode.

No txt-blend-mode — the baseline. The text is painted on top of the image.
https://assets.imgix.net/examples/bluehat.jpg?w=400&h=250&fit=crop&fm=png&txt=HELLO&txt-size=72&txt-align=center%2Cmiddle&txt-color=ffffff&txt-font=Avenir-Black&transparency=grid
drawn normally

To cut a geometric shape out of the image, see mask-invert. To cut with an image layer, see the knockout modes on blend-mode.