html5 canvas sprite sheet maker

HTML5 Canvas Sprite Sheet Maker

Generate HTML5 Canvas sprite sheets: an aligned PNG atlas plus a manifest.json of frame rectangles and fps. Draw each frame with one drawImage call.

live sprite · 8f @ 12 fps
▶ Ninja Sprint · 8F
Pack workbenchFree · alpha kept · drawImage ready

Pack a canvas-ready atlas

PNG frames into an aligned atlas plus manifest.json for canvas.

  • Exact frame rectangles for drawImage
  • Per-state fps and loop flags in the manifest
  • Transparent PNG for any canvas background

Drop files here to jump straight into the workbench

Accepts PNG · WebP · JPG · GIF · MP4 · MOV · WebM · no signup required

Instant Demo — Try Without UploadingNinja · 10 frames · 12 FPS
Ninja live animation preview
Packed Alpha Sheet (9180×420 px · 918×420 cell)
Ninja packed sprite sheet
Open the pack workbenchAccepts PNG · WebP · JPG · GIF · MP4 · MOV · WebM

Step by step

How it works..

Step 011
RAWframes/*.png

Add frames

Drop PNG frames; they are sorted by filename.

Step 022
SAFE PADDING + RECT

Set the cell

Choose a cell size and padding for a steady baseline.

Step 033
sheet.pngmanifest.json

Export for canvas

Download the PNG atlas and manifest.json with rectangles.

Supported Inputs

MP4, MOV, WebM (≤15s 1080p) · Animated GIF · PNG, WebP, JPG (≤240 frames)

Native Engine Exports

PNG Atlas + manifest.json · Godot 4 .tres · Phaser 3 JSON · Unity .meta · Aseprite · FNF XML

Anti-Jitter Alignment

Bottom-Baseline Foot Lock · BBox Center Anchor · Chroma Key & Edge De-Spill

100% Client-Side Privacy

Runs locally in your browser via Canvas 2D — zero server upload, no signup, no watermark.

Zero-Dependency HTML5 Canvas 2D Loop (TypeScript)

Download free sample PNG + manifest.json →

Render any packed PNG atlas and manifest.json directly on an HTML5 <canvas> using requestAnimationFrame and a 9-argument drawImage call:

canvas-sprite-loop.tstypescript
type FrameRect = { x: number; y: number; w: number; h: number };

export async function mountSpriteLoop(canvas: HTMLCanvasElement, base: string) {
  const [manifest, img] = await Promise.all([
    fetch(`${base}.manifest.json`).then((r) => r.json()),
    new Promise<HTMLImageElement>((res, rej) => {
      const el = new Image();
      el.onload = () => res(el);
      el.onerror = rej;
      el.src = `${base}.png`;
    }),
  ]);

  const state = Object.keys(manifest.frame_layout.rows)[0];
  const frames: FrameRect[] = manifest.frame_layout.rows[state];
  const fps: number = manifest.animation.rows[state]?.fps ?? 12;
  const ctx = canvas.getContext("2d")!;
  ctx.imageSmoothingEnabled = false;

  let start = performance.now();
  function tick(now: number) {
    const idx = Math.floor(((now - start) / 1000) * fps) % frames.length;
    const f = frames[idx];
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.drawImage(img, f.x, f.y, f.w, f.h, 0, 0, f.w, f.h);
    requestAnimationFrame(tick);
  }
  requestAnimationFrame(tick);
}
imageSmoothingEnabled = false preserves crisp pixel-art edges on high-DPI Retina displays.

What a Canvas Sprite Sheet Needs

A canvas does not know about frames. It only draws images at coordinates you give it, so everything about animation, from timing to clearing, is your code's job rather than the platform's. A sprite sheet is therefore just one image, and each frame is a source rectangle inside it that you pass to drawImage.

A manifest gives you those source rectangles as numbers, so you do not need an engine or a plugin, only the values and the image itself. Keeping a small game dependency-free is often the whole point. The manifest also states fps and a loop flag per state, which your animation loop reads to decide when to advance and whether to wrap.

Because the layout lives in data, the same render loop can play any sheet. You swap the JSON and the image, and the player keeps working with no code changes, which keeps a small codebase tidy. That separation also means a designer can add a new character without asking a programmer to touch the render loop.

A sheet also reduces network requests, since one image replaces a folder of frames. Fewer requests means faster loading and fewer chances for a missing file. For a browser game, that simplicity is often worth more than any engine feature.

Drawing Frames on a Canvas

Load the PNG, then for each frame call ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh). The first rectangle is the source frame; the second is where it lands on screen. Track elapsed time and advance the frame when it exceeds 1000 divided by fps, wrapping the index with modulo for a loop that never runs off the end.

Clear the canvas each frame with clearRect before drawing, otherwise trails from prior frames stay on screen and smear the motion into an unreadable blur. For pixel art, set imageSmoothingEnabled to false and scale by whole numbers, which keeps crisp edges instead of a soft blur when the sprite is drawn larger than its source size.

Handle device pixel ratio by scaling the canvas backing store. Keep the source rectangles exact and scale the destination, so frames stay sharp on retina screens without changing the atlas. Cache the loaded image and manifest once before the loop starts, because decoding during animation causes hitches on slower devices.

Clamp delta time so a background tab does not fast-forward through many frames when the user returns. A small cap keeps motion sane and prevents a sudden jump on focus. These small details separate a demo from a game that feels solid on real hardware.

Why a Manifest Beats a Uniform Grid

With a uniform grid you must assume all frames match, and one wide frame then draws clipped at runtime when the pose plays. You often notice it only after the art is approved. Explicit rectangles are exact, so your drawImage call uses the true frame box and mixed sizes just work without special-case code.

The manifest also documents timing. fps and loop live in data, not scattered through animation code where they are hard to change and easy to get out of sync. Handling device pixel ratio is simpler too, because you scale the destination rectangle, not the source regions, so the atlas stays untouched and frames remain pixel-exact.

It also makes the render loop reusable. One generic player reads the manifest and works for every character and state you ship, which keeps a small game's codebase tidy. When you add a character, you add data, not code, and the same tested loop handles it.

Finally, the manifest is portable. The same rectangles work in a canvas player, in Phaser, or in a native engine, so an asset built for a web prototype is not trapped in one runtime. That flexibility is cheap to preserve and expensive to retrofit later.

Workflow Tips for Canvas Developers

Keep frame rectangles in data and your render loop generic, so the same loop plays every state from the manifest with no per-state branching. Use requestAnimationFrame and a delta time in milliseconds, because fixed-step assumptions break on high refresh displays and make animation speed uneven across devices.

Packing and preview are free in the browser, and only AI generation spends credits with failed runs refunded automatically, so the free path covers most small-game needs. Cache the loaded image and manifest once before the loop starts, and clamp delta time so a background tab does not fast-forward through many frames.

Test on a real phone early. A loop that looks smooth on a desktop can stutter on a mid-range device, and catching that before you build more content saves a painful optimization pass later. Profile with the browser tools and watch for layout thrash in the render path.

Keep the manifest next to the PNG in your web build. Treating it as a static asset makes caching straightforward and keeps the pair in sync when you deploy. Re-export from the originals after edits rather than hand-patching the atlas, so the rectangles always match.

Measure the actual frame budget on your target device before adding more characters. A canvas player is cheap, but a busy scene can still miss frames, and knowing the headroom early tells you how much art and logic you can layer on. Profile with the browser tools, watch for layout thrash, and fix the render path before it becomes the bottleneck, because a steady frame rate matters more than extra polish on a slow device.

FAQ

Frequently asked questions.

Do I need a game engine for this?+
No. A sprite sheet and a manifest are enough. You draw each frame with the canvas drawImage method and the source rectangles from the manifest.
Is packing free?+
Yes. Packing, slicing, and export are free in the browser with no account. Only optional AI generation uses credits.
How do I animate with a delta time?+
Accumulate elapsed milliseconds and advance the frame when it passes 1000 divided by fps. Use modulo to loop the frame index.
How do I keep pixel art sharp?+
Set imageSmoothingEnabled to false on the context and scale by integer factors. Fractional scaling reintroduces blur.
Why is my sprite blurry on retina screens?+
Scale the canvas backing store by devicePixelRatio and use the destination rectangle to upscale. Keep the source rectangles exact.
Do frames upload anywhere?+
No. Packing and export run locally in your browser. Frames go to a server only if you request an AI step.
Can I use the atlas on a website?+
Yes. It is a standard PNG plus JSON. Load it with fetch and draw it on a canvas, or hand the rectangles to any renderer.