Skip to content
cosmodev ~/tools/sprite-sheet-packer

Sprite Sheet -pakkaaja

Images & Media

Pakkaa irralliset spritet yhdeksi optimoiduksi sheetiksi atlas JSON- ja CSS-tiedostoilla — kokonaan selaimessasi. Mitään ei ladata.

Drop sprites and press Pack — the sheet, atlas JSON, and CSS are built here, in your browser.

(Dokumentaatio englanniksi)

What it does

Packs any number of loose sprite images into a single optimized sprite sheet, plus the two companion files engines and stylesheets need: a generic JSON atlas and a ready-to-use CSS file. Packing runs the MaxRects best-short-side-fit algorithm with power-of-two sheet sizing, entirely in your browser — files are read with the File API and drawn to a local canvas; nothing uploads.

How to use

  1. Drop PNG sprites onto the drop zone (or click to browse). Each sprite shows its thumbnail, atlas id, and pixel size; drop more batches any time.
  2. Optionally enable Allow 90° rotation — sprites that fit better sideways are stored rotated and marked rotated: true in the atlas.
  3. Press Pack sheet. The preview shows the packed sheet, its dimensions, and how much of it is filled.
  4. Download the three outputs: sheet.png, sheet.json (atlas), and sheet.css (one class per sprite).

Examples

  • Four 16×16 tiles (run1.png … run4.png) → one 64×16 sheet, all four in a row, atlas frames run1…run4.
  • A 60×60 hero plus a 16×4 sword: with rotation on, the sword lands sideways in the 4-px strip beside the hero, marked rotated.
  • Twenty mixed-size icons → the sheet grows through power-of-two sizes (64, 128, 256…) until everything fits, then trims to the tight power-of-two bound.

Good to know

  • Sheet dimensions are always powers of two — friendly to GPU texture uploads. The packer starts small and grows, so the result stays tight.
  • Atlas ids come from filenames (extension stripped, other characters folded to -); duplicates get -2, -3 suffixes.
  • Rotation is opt-in: engines that don’t read the rotated flag should leave it off. CSS classes always describe the stored (possibly rotated) rectangle.
  • More sprites than the cap allows (4096 px by default) fails with the name of the sprite that overflowed — split the batch.
  • Everything runs in this tab. Reload the page and the sprites are gone — nothing is stored.
Lähdekoodi14 kieltä

100% client-side · datasi ei koskaan lähde selaimestasi. Oliko tästä hyötyä? Jaa se joukkuetoverillesi.