Staaarter

JPG Cropper

Uploads a JPG and extracts a rectangular sub-region defined by an x/y top-left coordinate plus a width and height, validating the rectangle lies entirely within the source image, then lets you download the cropped JPEG. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
editorcropimagecanvasjpg

Overview

Introduction

This tool extracts a precise rectangular region out of a JPG entirely in your browser, with no upload to any server.

You specify the exact top-left corner and size, giving pixel-perfect control over the crop.

What Is JPG Cropper?

A client-side JPG cropping tool that reads an uploaded image's pixel data and copies out the rectangle you specify by its top-left (x, y) coordinate and its width/height.

It's a straightforward extraction, not a resize: the cropped output keeps the original resolution of whatever region you selected.

How JPG Cropper Works

The tool validates that all four crop parameters are whole numbers, that width and height are at least 1 pixel, and that the requested rectangle lies entirely within the source image's bounds before copying that region pixel-by-pixel into a new, smaller image buffer.

Because it's a direct pixel copy rather than a resample, cropped pixels are always exact matches of the source, with no interpolation blur introduced.

When To Use JPG Cropper

Use it to remove unwanted edges from a photo, isolate a subject from a larger scene, or cut out a specific detail to use on its own.

It's also a useful first step before resizing to a specific final size, or before feeding the region into another tool like the social media preset fitter.

Features

Advantages

  • Runs entirely client-side; the uploaded photo is never sent to a server.
  • Pixel-perfect, non-destructive extraction with no resampling blur.
  • Clear validation prevents an out-of-bounds crop from silently failing.

Limitations

  • Only axis-aligned rectangular crops are supported, with no rotation or freeform shapes.
  • You must know or determine the exact pixel coordinates in advance; there's no interactive drag-to-select handle in this simple version.

Examples

Crop out the top-left quadrant

Input

A 800x600 JPG, x=0, y=0, width=400, height=300

Output

A 400x300 JPG of the top-left quarter

A simple quarter-image extraction.

Isolate a centered subject

Input

A 1200x800 JPG, x=300, y=150, width=600, height=500

Output

A 600x500 JPG centered on the subject

Removing distracting edges to focus on the main subject.

Best Practices & Notes

Best Practices

  • Note your source image's dimensions first so your x/y/width/height values stay within bounds.
  • Crop before resizing if you want the final output's aspect ratio to match a specific target exactly.

Developer Notes

cropJpg validates that all four parameters are integers, that width/height are at least 1, and that the rectangle fits within the source bounds, then copies the region pixel-by-pixel via the shared getPixel/setPixel helpers into a freshly allocated PixelBuffer, with no resampling involved.

JPG Cropper Use Cases

  • Removing unwanted edges or borders from a photo
  • Isolating a subject or detail from a larger image
  • Preparing a specific region before resizing to a final target size

Common Mistakes

  • Requesting a rectangle that extends past the source image's right or bottom edge and hitting a validation error.
  • Forgetting that x/y are measured from the top-left corner, not the center.

Tips

  • If you need a specific aspect ratio for a platform (Instagram, Twitter, etc.), the social media preset creator handles crop + resize together in one step.
  • Combine with the border adder afterward to frame the freshly cropped region.

References

Frequently Asked Questions