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.
Often used alongside JPG Margin Adder, JPG Border Remover and PNG Space Remover.
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
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.