PNG Slicer

Uploads a PNG and cuts it into a grid of rectangular slices at arbitrary, user-chosen pixel positions along the x and y axes, rather than an even grid, letting you carve out precisely-sized pieces for the classic web-mockup slicing workflow, then lets you download each resulting slice. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

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.

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

Slice a mockup into a 3-column header layout

Input

A 900x200 PNG, xCuts = [300, 600], yCuts = []

Output

Three 300x200 PNG slices arranged left to right

Two x cuts at 300 and 600 divide the image into three equal columns since no y cuts were given.

Slice out an uneven button region

Input

A 400x400 PNG, xCuts = [120, 280], yCuts = [50, 90]

Output

A 3x3 grid of 9 PNG slices with unevenly-sized rows and columns

Because cuts land at custom pixel positions instead of even intervals, the resulting rows and columns have different widths and heights, matching real design boundaries.

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.

References

Frequently Asked Questions