PNG Cropper

Uploads a PNG, decodes it onto an off-screen canvas, and extracts a rectangular sub-region defined by an exact top-left (x, y) coordinate plus a width and height, discarding everything outside that rectangle, then lets you download the cropped result. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool extracts an exact rectangular region from a PNG, entirely in your browser, by pixel coordinates.

It's the fundamental crop operation the site's cutter tool also builds on internally.

What Is PNG Cropper?

A client-side cropping tool that reads an uploaded PNG's pixel data and copies out a rectangular sub-region defined by a top-left (x, y) coordinate and a width and height, discarding everything else.

The cropped result keeps the exact original pixel data within that rectangle, with no scaling or resampling involved.

How PNG Cropper Works

The tool validates that the requested rectangle (x, y, width, height) lies entirely within the source image's dimensions, then copies each pixel from that region into a new, smaller output buffer at the corresponding relative position.

Because there's no resampling step, the cropped output is pixel-identical to the corresponding region of the source image.

When To Use PNG Cropper

Use it whenever you need a specific rectangular portion of a larger image, like isolating one icon from a sprite sheet or removing unwanted borders.

It's also the building block the cutter tool uses internally to slice an image into two pieces.

Features

Advantages

  • Runs entirely client-side; the uploaded image is never sent to a server.
  • Produces pixel-perfect results with no resampling loss, unlike a resize.
  • Exact numeric coordinate control for precise, repeatable crops.

Limitations

  • Requires knowing exact pixel coordinates ahead of time; there's no visual click-and-drag selection in this simple version.
  • Rejects any rectangle that extends past the source image's bounds rather than clipping or padding it automatically.

Examples

Isolate one icon from a sprite sheet

Input

A 256x64 PNG sprite sheet with four 64x64 icons, crop at x=64, y=0, width=64, height=64

Output

A standalone 64x64 PNG containing just the second icon

The crop rectangle exactly isolates the second 64-pixel-wide icon from the horizontal sprite strip.

Remove a border from a screenshot

Input

A 1000x800 PNG with a 20px border, crop at x=20, y=20, width=960, height=760

Output

A 960x760 PNG with the border removed

Insetting the crop rectangle by the border width on each side trims away the unwanted edge.

Best Practices & Notes

Best Practices

  • Check the source image's exact dimensions first (with the dimensions finder or viewer) before calculating crop coordinates.
  • If you need to remove a symmetric border, subtract the border width from each side when computing width/height.

Developer Notes

The lib function does a straightforward bounds-checked pixel copy using the shared getPixel/setPixel helpers rather than a canvas-level getImageData call, keeping it testable under Node; png-cutter.ts imports and reuses this exact function twice (for each half of a cut) rather than reimplementing rectangle extraction.

PNG Cropper Use Cases

  • Isolating a single icon from a sprite sheet
  • Removing an unwanted border or margin from a screenshot
  • Extracting a specific region of interest from a larger image

Common Mistakes

  • Miscalculating the crop rectangle so it extends past the image bounds, which the tool rejects rather than silently correcting.
  • Expecting the remaining content to be scaled up to fill a larger canvas — cropping only removes pixels, it never resizes what's left.

Tips

  • Use the viewer tool first to confirm exact source dimensions before planning crop coordinates.
  • For a simple two-piece split rather than an arbitrary rectangle, the cutter tool is a more direct fit.

References

Frequently Asked Questions