AutoCrop

Trim transparent pixels from a PNG

Trim the transparent border off a PNG here, in the browser, with no install and no upload. Drop one file or fifty; each is trimmed to its own content and can be downloaded individually or as a ZIP.

Below: how this compares with Photoshop, GIMP, Preview and ImageMagick, and the specific thing each of them gets wrong.

Drop image here

or

PNG, WebP or JPG · up to 50 MB · you can also paste from the clipboard

Your images are processed locally in your browser.

Ways to trim a PNG, compared

All of these trim transparent borders. They differ in threshold control, batching and whether your file leaves the machine.
ToolHowThreshold controlBatchCatch
AutoCropDrop the file in this pageYes, alpha 0–254Yes, ZIP outputOutput is always PNG; needs a modern browser
PhotoshopImage > Trim → Transparent PixelsNo — keeps any non-zero alphaOnly via an Action plus BatchCannot cut into a soft shadow at all
GIMPImage > Crop to ContentNoOnly via Script-FuSame shadow limitation, and no threshold
ImageMagickmagick in.png -trim +repage out.pngYes, via -fuzzYes, mogrifyForgetting +repage silently keeps the old canvas
macOS PreviewManual rectangle selectionNot applicableNoNot really trimming — you eyeball the rectangle
Most online croppersUpload, then manual or automatic cropRarelySometimesYour image is uploaded to someone else’s server

The threshold is what the desktop tools lack

Photoshop and GIMP both trim on “is this pixel transparent or not”, a binary test. Any pixel with an alpha value of 1 counts as content. For a flat logo that is exactly right, and all three tools give an identical result.

For anything with a drop shadow it is not enough. A blurred shadow extends a gradient of nearly invisible pixels dozens of pixels past the shape, and a binary test has to keep all of them. Photoshop offers no way to say “ignore anything under 20 percent opacity”, so the only workaround is hiding the shadow layer, trimming, and putting it back — which changes the composition you were exporting.

A threshold turns that into a slider. On a 340 × 340 shadowed icon, alpha > 5 gives 262 × 270 while alpha > 96 gives 216 × 224, the visible disc. The full measurement is on the home page.

When you should not trim

Automatic trimming is the wrong move more often than people expect:

  • Icon sets that must stay a consistent size. Trimming each file to its own content makes every icon a different size, and a 24 px grid falls apart. Trim the source artwork once, then export at fixed sizes.
  • App icons and store assets. Platforms specify exact dimensions and safe-area margins; the transparent padding is required, not accidental.
  • Sprite sheets that are still assembled. Trim the individual frames before packing, never the packed sheet.
  • Images whose transparent margin is deliberate spacing in a layout that references fixed pixel offsets.
  • Anything where the shadow is part of the design and must not be clipped — keep the threshold low, or trim with padding added back.

Trimming PNGs: questions

What does "trim" mean for an image?
Trimming removes uniform border pixels — transparent, or all one colour — until the edges of the canvas touch actual content. Unlike cropping, you do not choose the rectangle: it is derived from the pixels. The word comes from Photoshop, whose Image > Trim command does exactly this.
Is trimming the same as cropping?
Cropping is manual: you pick a rectangle. Trimming is automatic: the rectangle is computed from the content. AutoCrop trims, then optionally pads the result back out.
Does trimming a PNG lose quality?
No. The kept pixels are copied unchanged and re-encoded as lossless PNG. Nothing is resampled, rescaled or recompressed with loss.
Can I trim many PNGs at once without installing anything?
Yes. Select or drop multiple files and each is trimmed to its own content bounds, then download them together as a ZIP. Everything runs in the browser tab.
Why does Photoshop trim less than I expected?
Image > Trim with Transparent Pixels keeps every pixel with any opacity at all, which on a soft drop shadow means the near-invisible outer edge. It has no threshold setting, so you cannot ask it to cut deeper. AutoCrop exposes that threshold.