Overview
Introduction
This tool slices a PNG at custom pixel positions you choose, entirely in your browser, rather than forcing an even grid.
It's built for the classic web-mockup slicing workflow, where cuts need to land precisely on meaningful boundaries.
What Is PNG Slicer?
A client-side tool that takes lists of x and y pixel positions and cuts the image into a grid of rectangular slices at exactly those positions, reusing the site's existing crop lib function for every resulting cell.
Unlike an even-grid splitter, rows and columns produced by this tool can be any size, since you control precisely where each cut falls.
How PNG Slicer Works
The tool validates that every x and y cut is a whole number strictly between 0 and the image's width or height, then deduplicates and sorts the cuts to build a list of boundaries (0, each unique cut, and the full width/height).
For every row and column formed by consecutive boundaries, it calls the existing crop lib function to extract that rectangular region, building up a 2D grid of slices ordered by row then column.
When To Use PNG Slicer
Use it to slice a UI mockup or design comp into individual asset pieces (buttons, icons, header images) along their exact edges.
It's also handy for splitting a sprite sheet or scanned document into unevenly-sized meaningful sections.
Often used alongside PNG Dimensions Finder, PNG Rotator and PNG Transparency Checker.
Features
Advantages
- Runs entirely client-side; the uploaded image never leaves your device.
- Cuts can be placed at any pixel position, producing unevenly-sized slices unlike a fixed grid splitter.
- Cut order and duplicates in your input don't matter, since they're deduplicated and sorted automatically.
Limitations
- Every cut must be strictly inside the image bounds; a cut at exactly 0 or at the image's full width/height is rejected as redundant.
- Only whole-number pixel positions are supported; fractional cut positions aren't allowed.
Examples
Best Practices & Notes
Best Practices
- Zoom into your source mockup first to identify exact pixel boundaries before entering cut values.
- Enter cuts as a comma-separated list; duplicate or out-of-order values are handled automatically so you don't need to sort them yourself.
Developer Notes
The lib function operates on a plain Uint8ClampedArray PixelBuffer with no DOM dependency: it builds sorted boundary arrays via buildBoundaries (deduplicating cuts and adding 0 and the full width/height as implicit boundaries), then calls the existing cropPng lib function once per grid cell to produce the PixelBuffer[][] result, returning an error if any cut is non-integer or falls outside the open interval (0, size).
PNG Slicer Use Cases
- Slicing a web design mockup into individual button and icon assets
- Splitting a sprite sheet into unevenly-sized frames
- Cutting a scanned multi-panel document into separate images
Common Mistakes
- Entering a cut value equal to 0 or the image's full width/height, which is rejected since those are already implicit boundaries.
- Entering a decimal cut position — only whole-number pixel positions are accepted.
Tips
- Leave one axis's cuts empty when you only need to slice along a single direction (all rows or all columns).
- Use the dimensions finder tool first to confirm the exact width and height you're slicing within.