Toolvore

Image Trim

Trim transparent or solid-colour image borders with explicit thresholds and PNG export.

This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.

Image Trim removes complete transparent or near-solid outer rows and columns, optionally retaining an in-bounds margin, and saves the remaining decoded pixels as PNG without resizing.

How to use it

  1. 1Choose a still PNG or JPEG, or load the local example.
  2. 2Choose transparent or solid-color edges, threshold and retained margin.
  3. 3Trim and create PNG, inspect the removed-edge counts, then download.

Example

Input
8 × 6 image; content x=2–5, y=1–4; margin 1
Output
6 × 6 PNG from (1,0)

Margin retains available original pixels; it does not add padding.

What happens to your data

File checks, edge detection, cropping and PNG export happen locally. No source file or filename upload is required. Source metadata and profiles are not copied.

Last updated October 2026

Automatically remove empty outer space from a logo, exported diagram or product image. Image Trim finds the smallest rectangle containing pixels that do not match your chosen background rule, optionally retains an original-pixel margin, and exports PNG without resizing the retained area.

Choose transparent edges for a PNG with alpha, or solid-color edges for an opaque border such as white. This is border trimming, not object segmentation: it does not remove a background behind a subject or erase matching pixels inside the retained rectangle.

How it works

Open one still PNG or ordinary 8-bit JPEG up to 10 MiB, 12 million pixels and 8,192 pixels per side. PNG bit depths through 8-bit are supported. Animated PNG, GIF, WebP, HEIC, SVG, 16-bit PNG and compound JPEG are not accepted. The browser applies supported EXIF orientation before displaying the original dimensions. Processing and PNG export run locally, without uploading the source file or its name. Source metadata and color profiles are not copied, and browser decoding may change colors; keep the original.

Start with Transparent edges and an alpha threshold of 0: only pixels with zero alpha count as background. Increasing the threshold also classifies faint pixels as background and can cut away a shadow or soft edge. The scale is an 8-bit alpha value, 0–255, not a percentage. A threshold of 255 matches the entire image and deliberately refuses export rather than returning an empty image.

For Solid-color edges, choose an explicit RGB background color. At tolerance 0, a fully opaque pixel must match all three channels exactly. With tolerance 5 and white (#ffffff), opaque channels from 250 through 255 count as background. Tolerance is the maximum allowed difference per channel, not ImageMagick's fuzz percentage. Fully transparent pixels also count as background; partially transparent nonzero pixels remain content in this mode. This conservative rule avoids silently flattening semi-transparent artwork.

Every content pixel contributes to the bounding rectangle, including isolated marks and disconnected objects. Only complete outer rows and columns beyond that rectangle are removed. Retained margin expands the rectangle within the original image; it does not create new padding. For an 8 × 6 image whose content occupies x=2–5 and y=1–4, margin 0 exports 4 × 4 from (2,1). Margin 1 exports 6 × 6 from (1,0). A margin beyond an image edge simply retains that available edge.

Check the original preview, select Trim and create PNG, and inspect the result and four removed-edge counts. The exported crop uses original decoded pixel positions without resampling. Fully matching images show a clear error and no download. Changing settings or replacing the source removes the previous result. Use Crop Image for a manually chosen rectangle, Image Border to add padding, or Image Rounded Corners to mask corners.

Worked example: Remove transparent canvas around artwork

Input
8 × 6 PNG; content at x=2–5, y=1–4; alpha threshold 0; margin 1
Result
6 × 6 PNG, crop origin (1,0)

Retains one available original pixel around the detected content; no new pixels are added.

Common use cases

  • Removing unused transparent canvas around a logo
  • Trimming a uniform white border around an exported chart
  • Keeping a precise original-pixel margin around a screenshot
  • Preparing compact artwork before adding a deliberate border

Frequently asked questions

Does this remove the background behind my subject?+

No. It removes complete outside rows and columns only. Matching pixels inside the retained rectangle are untouched; use a separate background-removal workflow if you need segmentation.

Why did my white-bordered JPEG keep a narrow border?+

JPEG compression can make a visually white border slightly off-white. Use Solid-color edges with an explicit color and a small tolerance, then inspect the output. A stray mark or partially transparent pixel can also extend the content bounds.

Will a large threshold remove soft shadows?+

It can. Transparent mode treats alpha values at or below the threshold as background. Start at zero and increase cautiously. This affects which outer rows and columns are removed, not the remaining pixels themselves.

What happens if the image is entirely transparent or one matching color?+

No image is exported. The tool reports that every pixel matches the background so you can adjust the threshold or mode. It does not invent a one-pixel replacement.

Does margin add a border or resize the image?+

Neither. It retains available original pixels around the detected content, clamped to the source bounds. Use Image Border to add new padding or Image Resizer to change dimensions.