Overview
Introduction
This tool crops a rectangular region out of an icon PNG by exact pixel coordinates, entirely in your browser using the HTML canvas API.
It's a precise way to trim an icon down to just its glyph, or to pull a single icon out of a larger sprite sheet.
What Is Icon Cropper?
A client-side icon cropper that reads an uploaded icon's pixel data and copies out the rectangle you specify by its top-left (x, y) corner and its width and height.
The output PNG's dimensions exactly match the width and height you requested.
How Icon Cropper Works
The tool validates that x, y, width, and height are whole numbers, that width and height are at least 1 pixel, and that the requested rectangle lies entirely within the source icon's bounds.
It then copies each pixel from the corresponding position in the source image into a new, smaller pixel buffer at the requested size.
When To Use Icon Cropper
Use it to trim excess transparent or blank space around an icon's glyph, or to pull one icon out of a grid-based sprite sheet.
It's also useful for isolating a specific detail from a larger icon or graphic for closer inspection or reuse.
Often used alongside Icon Resizer and Icon Edges Cleaner.
Features
Advantages
- Runs entirely client-side; the uploaded icon is never sent to a server.
- Exact pixel-coordinate control, with clear validation errors if the requested rectangle doesn't fit.
- Direct pixel copy with no resampling, so the cropped region's quality exactly matches the source.
Limitations
- Coordinates must be entered manually as numbers — there's no interactive drag-to-select crop handle in this tool.
- The crop rectangle must lie entirely within the source image; partial or out-of-bounds crops are rejected rather than clamped.
Examples
Best Practices & Notes
Best Practices
- Check the source icon's exact dimensions first (with the PNG Dimensions Finder tool, for example) before entering crop coordinates.
- Preview the result before downloading to confirm the crop rectangle captured the intended region.
Developer Notes
The pure crop logic is reused as-is from the base PNG Cropper's cropPng function (a plain function over a Uint8ClampedArray pixel buffer, no DOM); this tool is a thin, subject-relabeled wrapper (cropIcon) around that same lib function, since cropping an icon is identical pixel math to cropping any other PNG.
Icon Cropper Use Cases
- Trimming transparent padding around an icon's glyph
- Extracting one icon from a sprite sheet grid
- Isolating a detail from a larger graphic for reuse
Common Mistakes
- Entering a crop rectangle that extends past the icon's edge, which is rejected rather than silently clamped.
- Forgetting that x/y/width/height must all be whole numbers — fractional pixel coordinates aren't valid.
Tips
- Use the PNG Dimensions Finder tool first to confirm the source icon's exact width and height.
- For sprite sheets, multiply the grid column/row index by the cell size to get x and y quickly.