Sprite Edge Prep

local processing
Fix the edges of sprites before they go into a game or an atlas: spread colour into transparent pixels (alpha bleed) to remove dark and white halos, replace baked-in edge colour, trim transparent borders, extrude and pad for atlases, pad sizes to a multiple and keep the pivot in the right place. Files stay in your browser.

Sprite Edge Prep

What it is

When a sprite is scaled or filtered by the GPU, the colour stored under its transparent pixels leaks into the edge. Most image editors save that colour as black or white, so you get a dark or light outline around the sprite. This tool fixes it in two ways. Alpha bleed spreads the sprite colour a few pixels into the transparent area without changing any transparency. Defringe replaces the colour of semi-transparent edge pixels that were flattened onto a white or black background. It can also trim empty borders, extrude the edge pixels and add transparent padding so neighbours in an atlas do not bleed into each other, round the size up to a multiple of 2, 4 or 8, and work out where your pivot ends up after trimming. A before and after preview shows the edge magnified the way a GPU does it. The PNG writer keeps the colour under transparent pixels, which browser canvases throw away.

When to use it

Use it on character, effect and UI sprites that show a halo when scaled or rotated, on sprites that will go into an atlas, or on a whole folder you need to trim consistently. Check the preview on the background colour of your game. Download a single PNG or a ZIP with a manifest of trim offsets and pivots.

Gotchas & limits

If your engine uses premultiplied alpha, bleeding is not needed but harmless; keep one convention for the whole project. Defringe changes the colour of soft edge pixels, so do not use it on glow, smoke or glass where the colour is meant to differ. Images that are not 8-bit PNG are read through the browser, which has already lost the colour under transparent pixels, so the before preview can look worse than your real file. Extrusion and padding make the image larger, so the sprite no longer fills the frame; use the exported pivot. Images over 4096 pixels on a side are not accepted.