Sprite Extractor
Drop files here or click (max 12 MB)
Why Use This Sprite Extractor?
- Automatic sprite detection based on transparency and configurable thresholds
- Clean cropping with optional trimming of transparent borders around each sprite
- Control padding, alignment (center/bottom) and optional uniform output size
- Preserves transparency (alpha channel) for PNG exports – ideal for tilemaps and characters
- Visual gallery of all detected sprites for quick inspection before download
- Client-side ZIP export using JSZip, keeping your filenames and sprite order stable
- Scratch-friendly: quickly turn a single sprite sheet into multiple costumes or assets
- Perfect for reusing assets across engines (Scratch, Godot, Unity 2D, Phaser, etc.)
🛠️ How to Extract Sprites from a Sprite Sheet for sprite-extractor
1. Drop your image
Drag & drop a sprite sheet or image into the dropzone, or click to choose a file. For best results, use PNG with transparent background or high contrast between sprites and background.
2. Run auto-detection
The tool sends a lightweight representation of your image to a detection endpoint, which computes bounding boxes for each sprite based on transparency and minimum size. The boxes are overlaid on your image so you can quickly see what will be exported.
3. Tune extraction options
Adjust padding, transparent background vs solid color, trimming of transparent edges, alignment (center or bottom), and optional uniform output width/height. The tool rebuilds each sprite canvas accordingly.
4. Preview sprites
Scroll through the gallery of generated sprites. Each preview is built on the client using an offscreen canvas and can be renamed or discarded depending on the UI options.
5. Download PNGs or a ZIP
Export individual PNG sprites or download a single ZIP file containing all current previews. The ZIP is built client-side using JSZip, and filenames follow a sequential pattern like <code>sprite_0000.png</code>, <code>sprite_0001.png</code>, etc.
Technical Specifications
Detection & Bounding Boxes
The detection phase runs on a dedicated backend endpoint and returns clean bounding boxes that the client uses to build final sprites.
| Aspect | Behavior | Notes |
|---|---|---|
| Detection endpoint | POST /api/sprite-extractor/inspect | Accepts a data URL and detection options, returns an array of sprite boxes. |
| Detection inputs | tolerance, alphaThreshold, minWidth, minHeight | Tune these parameters in the UI to ignore tiny noise or capture only meaningful sprites. |
| Box shape | Axis-aligned rectangles | Each <code>SpriteBox</code> holds <code>x</code>, <code>y</code>, <code>width</code>, <code>height</code> in source image coordinates. |
| Transparency handling | Alpha-aware | Transparent pixels contribute to cropping/trim decisions but can be preserved in output. |
| Error handling | Graceful fallbacks | If detection fails, the tool surfaces a readable error and does not break the UI. |
Cropping, Trimming & Alignment
Once boxes are known, all sprite rendering is done in the browser using HTML canvas.
| Step | Implementation | Details |
|---|---|---|
| Initial crop | drawImage(img, box.x, box.y, w, h, 0, 0, w, h) | Each sprite is first cropped from the original image onto a temporary canvas. |
| Transparent trim | scan alpha channel via getImageData | The tool scans pixels to compute the minimal non-transparent bounding box when trimming is enabled. |
| Padding | configurable 0–256 px | Padding is applied around the trimmed or cropped sprite to reduce edge artifacts in engines. |
| Alignment | center / bottom | Sprites can be centered or aligned to the bottom (useful for characters standing on a baseline). |
| Uniform output size | optional spriteWidth / spriteHeight | When enabled, all sprites are rendered into a fixed-size canvas to standardize animations. |
| Background | transparent or solid color | Either keep full transparency or fill the canvas with a chosen background RGBA color. |
Performance & Limits
Designed for interactive use in the browser.
| Parameter | Typical Behavior | Notes |
|---|---|---|
| Max input size | ~10 MB image | Larger files may still work but will load/detect more slowly. |
| Sprite count | up to ~400 sprites | Very high counts are possible, but preview rendering and ZIP creation will take longer. |
| Export format | PNG inside a ZIP (Blob) | The ZIP is generated entirely client-side using JSZip. |
| Canvas operations | Per-sprite cropping and drawing | Relies on the browser's 2D canvas API; performance scales with resolution and count. |
Command Line Alternatives
For massive sprite sheets or automated pipelines, you can combine CLI tools like ImageMagick with scripting.
Linux / 🍎 macOS
Uniform grid cropping with ImageMagick
convert spritesheet.png -crop 64x64 +repage sprite_%04d.pngCuts a regular 64×64 grid into individual PNG files.
Zip all sprites
zip sprites.zip sprite_*.pngPackage all generated sprites into a single archive.
Windows (PowerShell + ImageMagick)
Grid-based cropping
magick spritesheet.png -crop 64x64 +repage sprite_%%04d.pngSame as above, using the <code>magick</code> CLI on Windows.
Practical Use Cases
2D Game Development
- Extract character animation frames from a sprite sheet for Godot, Unity 2D, Phaser or Construct.
- Isolate UI elements (buttons, icons, health bars) from a design mock-up.
- Break down tilesets into individual tiles for level editors.
// Godot example: load multiple frames\nvar frames = []\nfor i in range(0, 8):\n frames.append(load(\"res://sprites/hero_walk_\" + str(i).pad_zeroes(2) + \".png\"))Scratch & Classroom Projects
- Turn a single sprite sheet into multiple costumes for a Scratch character.
- Prepare themed asset packs (animals, planets, icons) for programming workshops.
- Let students design sprite sheets in a drawing tool and then extract them for Scratch.
// Scratch-style pseudocode for simple animation\nwhen green flag clicked\nforever\n next costume\n wait 0.1 secondsPixel Art & Asset Libraries
- Split old pixel art sheets into a searchable library of individual sprites.
- Extract only the assets you need from large commercial or open-source packs.
- Normalize padding and alignment across sprites from different sources.
❓ Frequently Asked Questions
❓Is sprite detection fully automatic?
📏Does the extractor change my original image?
🎯Can I control padding and alignment?
🔒Are my images stored on the server?
🧊Will transparency be preserved in the exported sprites?
Pro Tips
Use a small amount of padding (2–4 px) around each sprite to prevent edge bleeding when scaling or rotating in your engine.
Name sprites consistently (e.g., <code>hero_run_0001.png</code>, <code>hero_run_0002.png</code>) to simplify animation imports and scripting.
In classroom settings, start with very simple sprite sheets (few big sprites, clear background) so students see immediate results.
Keep the exported ZIP alongside your project's source files so you can easily regenerate or tweak animations later.
Additional Resources
Other Tools
- CSS Beautifier
- HTML Beautifier
- Javascript Beautifier
- PHP Beautifier
- Color Picker
- Base64 Decoder
- Base64 Encoder
- Csharp Formatter
- Csv Formatter
- Dockerfile Formatter
- Elm Formatter
- ENV Formatter
- Go Formatter
- Graphql Formatter
- Hcl Formatter
- INI Formatter
- JSON Formatter
- Latex Formatter
- Markdown Formatter
- Objectivec Formatter
- Php Formatter
- Proto Formatter
- Python Formatter
- Ruby Formatter
- Rust Formatter
- Scala Formatter
- Shell Script Formatter
- SQL Formatter
- SVG Formatter
- Swift Formatter
- TOML Formatter
- Typescript Formatter
- XML Formatter
- YAML Formatter
- Yarn Formatter
- CSS Minifier
- Html Minifier
- Javascript Minifier
- JSON Minifier
- XML Minifier
- Http Headers Viewer
- PDF To Text
- Regex Tester
- Serp Rank Checker
- Whois Lookup