Overview
Introduction
This tool automatically trims empty transparent padding from around a PNG's visible content, computed entirely client-side.
It's the equivalent of an image editor's "trim" or "auto-crop to content" command.
What Is PNG Padding Remover?
An auto-trim tool that scans every pixel's alpha channel to find the tightest rectangle containing all non-transparent content, then crops the canvas down to exactly that rectangle.
Unlike removing a fixed-thickness border, it adapts to however much margin actually surrounds the content on each side.
How PNG Padding Remover Works
The tool first locates the minimum and maximum x/y coordinates among all pixels with nonzero alpha, forming a bounding box.
It then crops the image to that exact box, discarding any fully transparent margin outside it while preserving every visible pixel untouched.
When To Use PNG Padding Remover
Use it to clean up an exported icon or logo that has more transparent margin baked in than you want.
It's also useful before measuring or comparing an image's true visible dimensions, independent of how much empty space surrounds it.
Often used alongside PNG Padding Adder, PNG Space Adder and PNG Space Remover.
Features
Advantages
- Runs entirely client-side; your image never leaves the browser.
- Adapts to uneven margins automatically instead of assuming a fixed, symmetric border.
- Leaves every visible pixel completely untouched — only the transparent margin is removed.
Limitations
- It only detects fully transparent margin; a solid-color (opaque) background isn't recognized as "padding" to trim.
- A fully transparent image has no content to trim to, so the tool reports an error rather than guessing.
Examples
Best Practices & Notes
Best Practices
- Run this before measuring an image's true content dimensions, since exported assets often carry extra invisible margin.
- Check the transparency checker tool first if you're unsure whether an image has trimmable margin.
Developer Notes
This tool's lib function composes two existing pure lib functions — the outline finder (to compute the bounding box) and the cropper (to cut to it) — rather than re-deriving either; both operate on a plain Uint8ClampedArray pixel buffer with no DOM dependency.
PNG Padding Remover Use Cases
- Cleaning up an exported icon with excess transparent margin
- Preparing tightly-cropped assets for a sprite sheet
- Measuring an image's true visible content size
Common Mistakes
- Expecting this to trim a solid white or colored background — it only removes fully transparent (alpha 0) margin.
- Running it on a fully transparent image and expecting a valid (rather than an error) result.
Tips
- Pair this with the padding adder tool to standardize margins: trim first, then add back a consistent amount.
- Use the transparency checker tool afterward to confirm how much of the canvas is now visible content.