Skip to main content
Extrusion repeats the outermost row or column of pixels of each sprite outward by a configurable number of pixels before packing. The repeated pixels fill the spacing around each sprite in the atlas. This prevents color bleeding — the visual artifact where, at scaled or sub-pixel render sizes, the GPU samples past a sprite’s boundary and picks up the neighboring transparent or mis-colored pixels.

Configuration

.fpsheet
[sprites]
extrude = 1   # repeat edge pixels 1px outward (default: 0)
Extrusion is set via the project file. There is no dedicated CLI flag.
Higher values are rarely needed. 1 is enough for bilinear filtering; 2 is sometimes used with mipmapped sprites.

How it works

A 4×4 checkerboard sprite extruded by 1 pixel grows to 6×6 in the atlas. The 1-pixel border around it is a copy of the sprite’s edge pixels.
Original (4×4)     With extrude=1 in atlas (6×6)
B W B W            B B W B W W
W B W B            B B W B W W
B W B W            W W B W B B
W B W B            B B W B W W
                   W W B W B B
                   W W B W B B
The frame rect in the data file still points at the inner 4×4 region. The runtime does not need to know extrusion happened.

Examples

Prevent bleeding with bilinear filtering

[sprites]
extrude = 1
shape_padding = 2
At the default shape padding of 2, an extrude value of 2 means the duplicated edge sits exactly adjacent to the padding gap — no atlas space is wasted between the extruded border and the next sprite.

Mipmapped textures

For textures with mipmaps, use a higher extrude value:
[sprites]
extrude = 2
Make sure your shape_padding is at least equal to your extrude value, otherwise the extruded pixels may overlap neighboring sprites.

Technical details

Extrusion is applied during pre-processing, after trimming and before packing. The sprite’s pixel buffer grows by extrude pixels on every side; the packer sees the enlarged size. frame, spriteSourceSize, and sourceSize in the data file all reflect the original (pre-extrusion) dimensions. The atlas texture contains the extruded version, but the frame rect selects the inner region that excludes the duplicated border. Extrusion does not change trim behavior: if trimming is active, the sprite is trimmed first, then the trimmed result is extruded.

When to use extrusion

Extrusion is essential when:
  • Your renderer uses bilinear or trilinear filtering
  • Sprites are rendered at non-integer scales
  • Sprites are rendered at sub-pixel positions
  • Your atlas will be mipmapped
Without extrusion, you may see thin lines or color fringes at sprite edges where the GPU samples neighboring atlas regions.
TexturePacker calls this setting “Extrude” and applies the same edge-repeat logic. Atlas output with matching extrude values is visually and functionally equivalent.

Build docs developers (and LLMs) love