AutoCrop

Crop a transparent WebP

Drop a transparent WebP above and it is cropped to its visible content, in your browser. WebP alpha is read exactly the same way as PNG alpha, so the bounding box is just as precise.

WebP does have one quirk that PNG does not, and it is the reason a cropped WebP sometimes keeps a thin halo: lossy compression is applied to the alpha channel as well as the colour.

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.

Lossy alpha is why the halo happens

WebP can store transparency in two ways. Lossless WebP keeps the alpha channel exactly, pixel for pixel, exactly like PNG. Lossy WebP compresses the alpha channel too — and that is unusual. PNG alpha is always exact; JPEG has no alpha at all; lossy WebP is the common format where transparency itself is an approximation.

The practical consequence: a region that was perfectly transparent in your source can come back with alpha values of 1, 2 or 5 after lossy encoding. You cannot see them — at alpha 2 out of 255 nothing is visible — but a bounding box built on alpha > 5 may still include them, and the crop comes out larger than the shape you see. It looks exactly like a failed crop and is actually compression noise.

WebP variants and what to expect

VariantAlpha handlingCropping behaviour
Lossless WebP with alphaExact, like PNG.Pixel-exact bounding box. Default threshold of 5 is right.
Lossy WebP with alphaAlpha is compressed and approximated.May need a threshold of 10–30 to skip near-zero alpha noise.
Lossy WebP, no alphaFully opaque.Nothing to trim. AutoCrop reports the image has no transparency.
Animated WebPPer-frame alpha.Only the first frame is decoded, so the result is a still image.

Not sure which you have? webpinfo file.webp reports the format and whether an alpha channel is present.

Getting back to WebP afterwards

The download is a PNG on purpose: it is lossless, so trimming cannot degrade the image, and it carries alpha everywhere. If you need WebP again for delivery, convert the cropped file as a separate step so the compression happens exactly once:

  • cwebp -q 90 logo-cropped.png -o logo-cropped.webp for a lossy version, or add -lossless to keep alpha exact.
  • Squoosh in the browser, which also runs locally and lets you compare quality settings side by side.
  • Your build pipeline — most bundlers and image CDNs will generate WebP and AVIF from a PNG source automatically.

Converting to lossy WebP after trimming is the correct order. Trimming a lossy WebP and re-encoding it lossily would put the image through two generations of compression for no benefit.

WebP cropping: questions

Why does my cropped WebP download as a PNG?
PNG is the lossless, universally safe result: it keeps the alpha channel exactly and cannot introduce new artefacts. Re-encoding to lossy WebP would recompress pixels you only wanted trimmed. Convert the cropped PNG back to WebP afterwards with cwebp or Squoosh if you need the smaller file.
Does it work with animated WebP?
Only the first frame is read, so an animated WebP is effectively flattened to a still image. For animation, trim the frames before assembling them, or use a dedicated tool such as webpmux.
Why does my WebP have a faint halo after cropping?
Lossy WebP compresses the alpha channel too, which can leave very low alpha values in areas that were fully transparent in the source. Those count as content, so the bounding box grows. Raise the transparency threshold to about 10 to 30 and the halo disappears.
Is WebP transparency as accurate as PNG?
Lossless WebP alpha is exact, matching PNG. Lossy WebP alpha is approximate by design and may shift values slightly, which is what causes halo effects at the edges.
Can I crop a WebP in Safari?
Yes. Safari has decoded WebP since version 14, and AutoCrop falls back to an image element if the faster decode path is unavailable, so cropping works in current Safari on both macOS and iOS.