How to trim transparent pixels in Photoshop
Photoshop has had this feature since the late 1990s and the steps haven't really changed. Here is the short version, the version with all the gotchas, and the case for skipping Photoshop entirely when this is all you need.
The short version
- Open the image in Photoshop.
- Go to Image → Trim.
- Choose Based On: Transparent Pixels.
- Leave Top, Bottom, Left, Right all checked.
- Click OK.
- Export to PNG or WebP via File → Export → Export As.
That's it. The canvas shrinks to the bounding box of the non-transparent pixels.
The version with all the gotchas
1. The image must have an alpha channel
If the file is a JPEG, there is no transparency to trim. JPEG cannot store an alpha channel — that's part of why we wrote a whole page on the alpha channel. You'll need to use Trim Based On: Top Left Pixel Color or Bottom Right Pixel Color instead, which is a different operation and won't produce a transparent result.
2. "Flatten Image" will destroy your transparency
If you accidentally Layer → Flatten Image before exporting, Photoshop replaces every transparent pixel with white. You'll then end up with a white-bordered PNG instead of a tight, transparent one. The fix: undo, or skip flattening entirely.
3. PNGs from older Save For Web are different from Export As
Modern Photoshop ships two export paths. Use File → Export → Export As with Transparency checked. The legacy Save for Web (Legacy) dialog still works but is slower and downsamples some color profiles unexpectedly.
4. Trim doesn't resize, it just shrinks the canvas
Trim removes empty rows and columns at the edges. The visible content stays at its original pixel size. If you also need to scale the result, do that as a separate step via Image → Image Size — or use the Triim resize tool after trimming.
5. Anti-aliased edges sometimes survive the trim
Photoshop's default Trim treats anything with alpha > 0 as "not transparent." A faint 1px halo around your subject can leave the canvas larger than you expect. Two options: clean up the halo with Layer → Matting → Defringe before trimming, or use a tool with a configurable alpha threshold.
The case for skipping Photoshop
Photoshop is the right tool when you are also retouching, masking, or compositing. For a pure trim — open, trim, save — opening Photoshop is over-engineering a one-second operation. A few honest tradeoffs:
- Startup cost. Photoshop takes a few seconds to launch. A browser tab takes none.
- Batch. Trimming twenty exports in Photoshop is twenty round-trips through Image → Trim → Export. A browser tool lets you drop twenty files at once and download a ZIP.
- Licensing. Photoshop is a paid subscription. A browser tool doesn't care whether you have an Adobe seat.
- Privacy. Both keep files local in this case — Photoshop and Triim both process on your machine. The difference is upload-based competitors (which Triim explicitly is not).
Doing the same thing in Triim
The Triim trim tool reproduces Photoshop's Image → Trim → Transparent Pixels in your browser:
- Open triim.ca.
- Drag your PNG or WebP files onto the drop zone (up to 20 at a time).
- Click Process Images.
- Download each trimmed file or the entire batch as a ZIP.
The alpha threshold defaults to a value that preserves anti-aliased edges (the "faint halo" gotcha above), so what you see is what you keep. Nothing is uploaded — every pixel stays in your browser, the same way Photoshop keeps them on your local disk.