Staaarter

JPG Margin Remover

Uploads a JPG and crops a different, independently specified amount off of each of the top, right, bottom, and left edges, the exact inverse of adding per-side margins, then downloads the cropped result as a JPG. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
editormargincropcanvasjpg

Overview

Introduction

This tool crops independent per-side margins off a JPG in a single pass, entirely client-side.

It's the exact inverse of JPG Margin Adder, and the asymmetric sibling of JPG Border Remover.

What Is JPG Margin Remover?

A client-side JPG cropping tool that removes a potentially different number of pixels from each of the top, right, bottom, and left edges in one operation, rather than requiring four separate uniform crops.

It doesn't inspect pixel colors; it always removes exactly the amounts you specify per side.

How JPG Margin Remover Works

The tool computes the output width as the original width minus the left and right amounts, and the output height as the original height minus the top and bottom amounts, then copies the corresponding interior region starting at (left, top) in the source into a new buffer.

If the requested margins would leave nothing behind, the tool rejects the request with a clear error rather than producing a broken or zero-size image.

When To Use JPG Margin Remover

Use it to undo margins added with JPG Margin Adder, or to clean up an asymmetric export from a design tool where, say, only the top and left have unwanted whitespace.

If the amount to trim is the same on every side, JPG Border Remover needs only one input instead of four.

Features

Advantages

  • Runs entirely client-side.
  • Full independent control over all four sides in one pass.
  • Exact inverse of JPG Margin Adder, so pairing the two round-trips cleanly.

Limitations

  • Requires four separate inputs even when the amount happens to be the same on every side.
  • Doesn't auto-detect margin size; you need to know or estimate it per side.

Examples

Undo an asymmetric margin

Input

A 1200x760 JPG with top 80, right 0, bottom 80, left 0 margins added earlier

Output

The original 1200x600 photo with the caption bands cropped away

The exact inverse of the JPG Margin Adder example that created it.

Trim uneven whitespace from a design export

Input

A 1000x1000 JPG with unwanted top 40 / left 20 whitespace only

Output

A 980x960 JPG with just that whitespace trimmed

Handles the common case where only some sides need trimming.

Best Practices & Notes

Best Practices

  • Check the preview after cropping to confirm you trimmed the right sides; it's easy to mix up top/bottom or left/right.
  • Keep a copy of the original file, since cropping discards the removed pixels once downloaded.

Developer Notes

removeJpgMargin validates each of the four margin values independently, computes the output size from (width - left - right) and (height - top - bottom), then copies the interior region starting at (left, top): the per-side counterpart to removeJpgBorder's single-thickness crop.

JPG Margin Remover Use Cases

  • Undoing margins added by JPG Margin Adder
  • Trimming uneven whitespace from a design tool export
  • Cleaning up asymmetric scan or crop artifacts

Common Mistakes

  • Swapping which value goes to which side (top vs. bottom, left vs. right).
  • Leaving all four values at 0, which the tool rejects since nothing would change.

Tips

  • For a uniform amount on every side, JPG Border Remover is simpler.
  • For automatic detection instead of manual per-side values, try JPG Empty Space Remover.

References

Frequently Asked Questions