feat: add Sprite Splitter tool and support X/Y offsets in Inset Crop Tool (v1.3.0)

This commit is contained in:
2026-05-14 10:37:53 +08:00
parent 981fae1693
commit 3b60f270d7
5 changed files with 383 additions and 13 deletions

View File

@@ -91,6 +91,7 @@ Remove Chroma Key background and perform intelligent inset cropping and enlargem
- **Real-time Preview** - Instantly view background removal effects while adjusting threshold.
- **Preview Background Customization** - Change preview background color to check edge precision (inspection only, does not affect export).
- **Inset Guide Lines** - Display dashed lines showing each cell's inset boundary (pink dashed outline) for visual verification of inset effects.
- **Coordinate Offset** - Support for X/Y axis offset adjustment to handle misaligned grids.
- **Smart Cropping** - Precisely divide cells based on rows/columns and inset distance.
- **Enlarge After Crop** - Automatically enlarge back to original cell size after inset cropping.
- **Batch Export** - Export individual cell PNGs + combined full image.
@@ -100,6 +101,19 @@ Remove Chroma Key background and perform intelligent inset cropping and enlargem
---
### 📦 Sprite Splitter
The simplest tool to split a Sprite Sheet into grid cells and package them into a ZIP file.
**Key Features:**
- Automatically calculates cell size based on row and column counts.
- Real-time preview of grid split lines.
- One-click packaging of all cells into a ZIP archive for download.
- Pixel-art optimized rendering (maintains sharpness).
**Use Cases:** Quick decomposition of asset packs, animation sequence export.
---
## 🚀 Quick Start
### Prerequisites
@@ -131,6 +145,7 @@ Visit the home page to see all available tools, or access them directly:
- **Sprite Flipper**: `http://localhost:8000/flipper/`
- **Sprite Merger**: `http://localhost:8000/merger/`
- **Inset Crop Tool**: `http://localhost:8000/inset/`
- **Sprite Splitter**: `http://localhost:8000/splitter/`
## 📂 Project Structure
@@ -144,6 +159,7 @@ SpriteTool/
├── rotate.py # Flipper core processing logic
├── sprite_merger.py # Sprite Merger sub-app
├── inset_crop_tool.py # Inset Crop Tool sub-app
├── sprite_splitter.py # Sprite Splitter sub-app
├── remove_pink_background.py # Color removal tool (standalone use)
├── output/ # Grid Tool export directory
├── shiny_output/ # Shiny Maker export directory
@@ -211,6 +227,7 @@ SpriteTool/
- Confirm the background removal result.
3. **Configure Crop Parameters**
- Enter grid row and column counts (Cols/Rows).
- Adjust **X/Y Offset** to align the grid correctly.
- Set inset distance (px) for all edges.
- View calculated cell size and output count.
4. **Confirm and Download**
@@ -218,6 +235,12 @@ SpriteTool/
- System executes: Remove background → Inset crop → Enlarge back → Package.
- Download ZIP containing all individual cell PNGs + combined image.
### Sprite Splitter Workflow
1. **Upload Image** - Select the Sprite Sheet to split.
2. **Set Grid** - Enter row and column counts; the preview will show blue split lines instantly.
3. **Download** - Click "Download ZIP" to get all individual cell files.
---
## 🛠️ Technical Architecture
@@ -270,6 +293,10 @@ SpriteTool/
- `GET /inset/` - Home page.
- `POST /inset/preview` - Real-time background removal preview.
- `POST /inset/process` - Execute background removal + cropping + packaging.
### Sprite Splitter
- `GET /splitter/` - Home page.
- `POST /splitter/process` - Execute grid splitting and packaging.
---
## 🎨 UI/UX Features
@@ -332,4 +359,4 @@ Issues and Pull Requests are welcome!
---
**Last Updated**: May 2026
**Version**: 1.2.0
**Version**: 1.3.0