ruby_spriter 0.6.7.1 → 0.7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +3 -3
- data/CHANGELOG.md +1035 -524
- data/Gemfile +17 -17
- data/LICENSE +21 -21
- data/README.md +183 -950
- data/bin/ruby_spriter +20 -20
- data/lib/ruby_spriter/background_sampler.rb +140 -0
- data/lib/ruby_spriter/batch_processor.rb +268 -214
- data/lib/ruby_spriter/cell_cleanup_config.rb +21 -0
- data/lib/ruby_spriter/cell_cleanup_gimp_script.rb +123 -0
- data/lib/ruby_spriter/cell_cleanup_processor.rb +230 -0
- data/lib/ruby_spriter/cli.rb +676 -612
- data/lib/ruby_spriter/compression_manager.rb +101 -101
- data/lib/ruby_spriter/consolidator.rb +179 -179
- data/lib/ruby_spriter/dependency_checker.rb +224 -224
- data/lib/ruby_spriter/ghost_edge_cleaner.rb +164 -0
- data/lib/ruby_spriter/gimp_processor.rb +1188 -1058
- data/lib/ruby_spriter/metadata_manager.rb +117 -116
- data/lib/ruby_spriter/platform.rb +137 -137
- data/lib/ruby_spriter/processor.rb +1230 -891
- data/lib/ruby_spriter/smoke_detector.rb +223 -0
- data/lib/ruby_spriter/threshold_stepper.rb +227 -0
- data/lib/ruby_spriter/utils/file_helper.rb +82 -82
- data/lib/ruby_spriter/utils/image_helper.rb +16 -0
- data/lib/ruby_spriter/utils/output_formatter.rb +65 -65
- data/lib/ruby_spriter/utils/path_helper.rb +59 -59
- data/lib/ruby_spriter/utils/spritesheet_splitter.rb +86 -86
- data/lib/ruby_spriter/version.rb +6 -7
- data/lib/ruby_spriter/video_processor.rb +357 -139
- data/lib/ruby_spriter.rb +38 -34
- data/ruby_spriter.gemspec +44 -42
- data/spec/fixtures/centered_sprite_with_inner_bg.png +0 -0
- data/spec/fixtures/centered_sprite_with_inner_bg_inner_removed.png +0 -0
- data/spec/fixtures/centered_sprite_with_inner_bg_threshold_stepped.png +0 -0
- data/spec/fixtures/complex_background_sprite.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing.mp4 +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185027_431-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185027_431.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185125_738-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185125_738.png +0 -0
- data/spec/fixtures/has_inner_bg.png +0 -0
- data/spec/fixtures/has_small_inner_bg.png +0 -0
- data/spec/fixtures/smoke_effect_sprite.png +0 -0
- data/spec/fixtures/spritesheet_with_metadata.png +0 -0
- data/spec/fixtures/test_sprite.png +0 -0
- data/spec/fixtures/test_sprite_smoke_processed.png +0 -0
- data/spec/fixtures/test_video_spritesheet.png +0 -0
- data/spec/fixtures/transparent_bg_sprite.png +0 -0
- data/spec/fixtures/walk_north_sprite-sheet.png +0 -0
- data/spec/integration/no_fuzzy_mode_spec.rb +100 -0
- data/spec/ruby_spriter/batch_processor_spec.rb +509 -200
- data/spec/ruby_spriter/cli_spec.rb +2026 -1892
- data/spec/ruby_spriter/compression_manager_spec.rb +157 -157
- data/spec/ruby_spriter/consolidator_spec.rb +538 -538
- data/spec/ruby_spriter/gimp_processor_spec.rb +523 -425
- data/spec/ruby_spriter/platform_spec.rb +92 -92
- data/spec/ruby_spriter/processor_spec.rb +911 -735
- data/spec/ruby_spriter/utils/file_helper_spec.rb +150 -150
- data/spec/ruby_spriter/utils/path_helper_spec.rb +78 -78
- data/spec/ruby_spriter/utils/spritesheet_splitter_spec.rb +104 -104
- data/spec/ruby_spriter/video_processor_spec.rb +346 -29
- data/spec/spec_helper.rb +41 -41
- data/spec/tmp/cli_test_output.png +0 -0
- data/spec/tmp/cli_test_output_20251105_114647_395.png +0 -0
- data/spec/tmp/combined_test.png +0 -0
- data/spec/tmp/compat_test.png +0 -0
- data/spec/tmp/compat_test_20251030_174233_361.png +0 -0
- data/spec/tmp/final_all_features.png +0 -0
- data/spec/tmp/final_test_all_features.png +0 -0
- data/spec/tmp/full_pipeline_test.png +0 -0
- data/spec/tmp/inner_test.png +0 -0
- data/spec/tmp/integration_test.png +0 -0
- data/spec/tmp/validation_test.png +0 -0
- data/spec/unit/background_sampler_spec.rb +132 -0
- data/spec/unit/cell_cleanup_config_spec.rb +32 -0
- data/spec/unit/cell_cleanup_gimp_script_spec.rb +59 -0
- data/spec/unit/cell_cleanup_processor_spec.rb +261 -0
- data/spec/unit/ghost_edge_cleaner_spec.rb +223 -0
- data/spec/unit/gimp_processor_single_point_selection_spec.rb +81 -0
- data/spec/unit/smoke_detector_spec.rb +246 -0
- data/spec/unit/threshold_stepper_spec.rb +195 -0
- metadata +56 -10
data/README.md
CHANGED
|
@@ -1,950 +1,183 @@
|
|
|
1
|
-
# Ruby Spriter v0.
|
|
2
|
-
|
|
3
|
-
[](https://www.ruby-lang.org/)
|
|
4
|
-
[](LICENSE)
|
|
5
|
-
[]()
|
|
6
|
-
|
|
7
|
-
**Professional MP4 to Spritesheet Converter with Advanced Image Processing**
|
|
8
|
-
|
|
9
|
-
A powerful cross-platform Ruby tool for creating high-quality spritesheets from video files and processing them with professional-grade image manipulation. Perfect for game development workflows, particularly with Godot Engine.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## ✨ Features
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- 📐 **Spritesheet Consolidation** - Merge multiple spritesheets vertically
|
|
20
|
-
- 📊 **Metadata Management** - Embed, verify, and add grid information to PNG files
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
| **
|
|
68
|
-
| **
|
|
69
|
-
| **
|
|
70
|
-
| **
|
|
71
|
-
| **
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Ruby
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
# Install GIMP 3.x via Flatpak (recommended)
|
|
186
|
-
sudo dnf install flatpak -y
|
|
187
|
-
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
188
|
-
flatpak install flathub org.gimp.GIMP -y
|
|
189
|
-
|
|
190
|
-
# Install Xvfb for headless GIMP operation
|
|
191
|
-
sudo dnf install xorg-x11-server-Xvfb -y
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
### Choose Your Installation Method
|
|
197
|
-
|
|
198
|
-
#### 📦 **Option A: RubyGems (Recommended)**
|
|
199
|
-
|
|
200
|
-
Install the published gem from RubyGems.org:
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
gem install ruby_spriter
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
**Requirements**: Ruby 2.7 or higher
|
|
207
|
-
**Best for**: All platforms (Windows, macOS, Linux), automated workflows
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
#### 🛠️ **Option B: From Source (Development)**
|
|
212
|
-
|
|
213
|
-
Clone and build from source:
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
# Clone repository
|
|
217
|
-
git clone https://github.com/scooter-indie/ruby-spriter.git
|
|
218
|
-
cd ruby-spriter
|
|
219
|
-
|
|
220
|
-
# Install development dependencies
|
|
221
|
-
bundle install
|
|
222
|
-
|
|
223
|
-
# Build and install gem locally
|
|
224
|
-
gem build ruby_spriter.gemspec
|
|
225
|
-
gem install ruby_spriter-0.6.7.gem
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
**Best for**: Contributors, developers wanting latest code
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
### Verify Installation
|
|
233
|
-
|
|
234
|
-
After installing Ruby Spriter via any method:
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
# Check Ruby Spriter version
|
|
238
|
-
ruby_spriter --version
|
|
239
|
-
|
|
240
|
-
# Verify all dependencies
|
|
241
|
-
ruby_spriter --check-dependencies
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
The `--check-dependencies` command checks all external tools:
|
|
245
|
-
- ✅ **Tool found**: Shows version and path
|
|
246
|
-
- ❌ **Tool missing**: Shows platform-specific installation commands
|
|
247
|
-
|
|
248
|
-
Example output:
|
|
249
|
-
```
|
|
250
|
-
Checking external dependencies...
|
|
251
|
-
|
|
252
|
-
✓ FFmpeg found: 6.0 (C:\ProgramData\chocolatey\bin\ffmpeg.exe)
|
|
253
|
-
✓ FFprobe found: 6.0 (C:\ProgramData\chocolatey\bin\ffprobe.exe)
|
|
254
|
-
✓ ImageMagick (convert) found: 7.1.1-15 (C:\Program Files\ImageMagick\convert.exe)
|
|
255
|
-
✓ ImageMagick (identify) found: 7.1.1-15 (C:\Program Files\ImageMagick\identify.exe)
|
|
256
|
-
✓ GIMP found: 2.99.16 (C:\Program Files\GIMP 3\bin\gimp-2.99.exe)
|
|
257
|
-
|
|
258
|
-
All dependencies are installed!
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## 🎯 Quick Start
|
|
264
|
-
|
|
265
|
-
### Basic Video to Spritesheet
|
|
266
|
-
```bash
|
|
267
|
-
# Create 4x4 grid with 16 frames
|
|
268
|
-
ruby_spriter --video input.mp4
|
|
269
|
-
|
|
270
|
-
# Custom grid and frame count
|
|
271
|
-
ruby_spriter --video input.mp4 --frames 32 --columns 8
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### High-Quality Scaling
|
|
275
|
-
```bash
|
|
276
|
-
# Scale to 50% with best quality interpolation
|
|
277
|
-
ruby_spriter --video input.mp4 --scale 50 --interpolation nohalo
|
|
278
|
-
|
|
279
|
-
# Scale and sharpen for crisp results
|
|
280
|
-
ruby_spriter --video input.mp4 --scale 50 --sharpen
|
|
281
|
-
|
|
282
|
-
# Custom sharpening for maximum detail
|
|
283
|
-
ruby_spriter --video input.mp4 --scale 50 --sharpen \
|
|
284
|
-
--sharpen-gain 1.5 --sharpen-radius 3.0
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Background Removal
|
|
288
|
-
```bash
|
|
289
|
-
# Remove background (auto-optimized order)
|
|
290
|
-
ruby_spriter --video input.mp4 --scale 50 --remove-bg
|
|
291
|
-
|
|
292
|
-
# Process existing spritesheet
|
|
293
|
-
ruby_spriter --image sprite.png --remove-bg --fuzzy
|
|
294
|
-
|
|
295
|
-
# Fine-tune background removal
|
|
296
|
-
ruby_spriter --image sprite.png --remove-bg \
|
|
297
|
-
--threshold 1.5 --grow 2
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Batch Processing (v0.6.7+)
|
|
301
|
-
```bash
|
|
302
|
-
# Process all videos in a directory
|
|
303
|
-
ruby_spriter --batch --dir "videos/"
|
|
304
|
-
|
|
305
|
-
# Batch process with scaling and compression
|
|
306
|
-
ruby_spriter --batch --dir "videos/" --scale 50 --max-compress
|
|
307
|
-
|
|
308
|
-
# Batch process with output to different directory
|
|
309
|
-
ruby_spriter --batch --dir "videos/" --outputdir "output/"
|
|
310
|
-
|
|
311
|
-
# Batch process and consolidate all results
|
|
312
|
-
ruby_spriter --batch --dir "videos/" --batch-consolidate
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### Consolidate Spritesheets
|
|
316
|
-
```bash
|
|
317
|
-
# Consolidate specific files (comma-separated)
|
|
318
|
-
ruby_spriter --consolidate file1.png,file2.png,file3.png
|
|
319
|
-
|
|
320
|
-
# Consolidate all spritesheets in a directory (v0.6.7+)
|
|
321
|
-
ruby_spriter --consolidate --dir "spritesheets/"
|
|
322
|
-
|
|
323
|
-
# Consolidate with compression
|
|
324
|
-
ruby_spriter --consolidate --dir "spritesheets/" --max-compress
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Frame Extraction (v0.6.8+)
|
|
328
|
-
```bash
|
|
329
|
-
# Extract specific frames by number
|
|
330
|
-
ruby_spriter --image sprite.png --extract 1,2,4,5,8 --columns 3
|
|
331
|
-
|
|
332
|
-
# Extract with duplicates for animation loops
|
|
333
|
-
ruby_spriter --image sprite.png --extract 1,1,2,2,3,3
|
|
334
|
-
|
|
335
|
-
# Extract, process, and save frames
|
|
336
|
-
ruby_spriter --image sprite.png --extract 1,3,5,7 \
|
|
337
|
-
--scale 50 --sharpen --save-frames
|
|
338
|
-
|
|
339
|
-
# Workflow: Add metadata then extract frames
|
|
340
|
-
ruby_spriter --image external.png --add-meta 4:4
|
|
341
|
-
ruby_spriter --image external.png --extract 1,5,9,13 --columns 2
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
### Metadata Management (v0.6.8+)
|
|
345
|
-
```bash
|
|
346
|
-
# Add metadata to external spritesheet
|
|
347
|
-
ruby_spriter --image sprite.png --add-meta 4:4
|
|
348
|
-
|
|
349
|
-
# Add metadata with partial grid (14 frames in 4x4 grid)
|
|
350
|
-
ruby_spriter --image sprite.png --add-meta 4:4 --frames 14
|
|
351
|
-
|
|
352
|
-
# Replace existing metadata
|
|
353
|
-
ruby_spriter --image existing.png --add-meta 8:8 --overwrite-meta
|
|
354
|
-
|
|
355
|
-
# Add metadata and copy to new file
|
|
356
|
-
ruby_spriter --image sprite.png --add-meta 4:4 --output sprite_meta.png
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Advanced Workflows
|
|
360
|
-
```bash
|
|
361
|
-
# Complete processing pipeline with compression
|
|
362
|
-
ruby_spriter --video input.mp4 \
|
|
363
|
-
--frames 64 --columns 8 \
|
|
364
|
-
--scale 50 --interpolation nohalo \
|
|
365
|
-
--remove-bg \
|
|
366
|
-
--sharpen --sharpen-gain 0.8 \
|
|
367
|
-
--max-compress
|
|
368
|
-
|
|
369
|
-
# Process existing image with quality enhancement
|
|
370
|
-
ruby_spriter --image large_sprite.png \
|
|
371
|
-
--scale 50 --interpolation lohalo \
|
|
372
|
-
--sharpen --sharpen-gain 1.2
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## 📚 Usage
|
|
378
|
-
|
|
379
|
-
### Command-Line Options
|
|
380
|
-
|
|
381
|
-
#### **Input Options**
|
|
382
|
-
```bash
|
|
383
|
-
-v, --video FILE Input video file (MP4 only)
|
|
384
|
-
-i, --image FILE Input image file (PNG only)
|
|
385
|
-
--batch Batch process mode (use with --dir)
|
|
386
|
-
--dir DIRECTORY Directory for batch or consolidate operations
|
|
387
|
-
--consolidate [FILES] Consolidate spritesheets (comma-separated files or use with --dir)
|
|
388
|
-
--verify FILE Verify spritesheet metadata (PNG only)
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
#### **Spritesheet Options**
|
|
392
|
-
```bash
|
|
393
|
-
-o, --output FILE Output file path
|
|
394
|
-
-f, --frames COUNT Number of frames to extract (default: 16)
|
|
395
|
-
-c, --columns COUNT Grid columns (default: 4)
|
|
396
|
-
-w, --width PIXELS Max frame width (default: 320)
|
|
397
|
-
-b, --background COLOR Tile background: black, white (default: black)
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
#### **Scaling Options**
|
|
401
|
-
```bash
|
|
402
|
-
-s, --scale PERCENT Scale image by percentage
|
|
403
|
-
--interpolation METHOD Interpolation: none, linear, cubic, nohalo, lohalo
|
|
404
|
-
(default: nohalo)
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
#### **Sharpening Options**
|
|
408
|
-
```bash
|
|
409
|
-
--sharpen Apply unsharp mask after scaling
|
|
410
|
-
--sharpen-radius VALUE Radius in pixels (default: 2.0)
|
|
411
|
-
--sharpen-gain VALUE Gain/strength (default: 0.5, range: 0.0-2.0+)
|
|
412
|
-
--sharpen-threshold VALUE Threshold fraction (default: 0.03, range: 0.0-1.0)
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
#### **Background Removal Options**
|
|
416
|
-
```bash
|
|
417
|
-
-r, --remove-bg Remove background using GIMP
|
|
418
|
-
-t, --threshold VALUE Feather radius (default: 0.0)
|
|
419
|
-
-g, --grow PIXELS Pixels to grow selection (default: 1)
|
|
420
|
-
--fuzzy Use fuzzy select (contiguous) - DEFAULT
|
|
421
|
-
--no-fuzzy Use global color select (all matching)
|
|
422
|
-
--order ORDER Operation order: scale_first, bg_first
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
#### **Preset Configurations**
|
|
426
|
-
```bash
|
|
427
|
-
--preset thumbnail 3×? grid, 9 frames, 240px wide
|
|
428
|
-
--preset preview 4×? grid, 16 frames, 400px wide
|
|
429
|
-
--preset detailed 10×? grid, 50 frames, 320px wide
|
|
430
|
-
--preset contact 8×? grid, 64 frames, 160px wide
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
#### **Batch Processing Options (v0.6.7+)**
|
|
434
|
-
```bash
|
|
435
|
-
--batch Enable batch processing mode
|
|
436
|
-
--dir DIRECTORY Directory containing MP4 files to process
|
|
437
|
-
--outputdir DIRECTORY Output directory for processed files
|
|
438
|
-
--batch-consolidate Consolidate all resulting spritesheets
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
#### **Compression Options (v0.6.7+)**
|
|
442
|
-
```bash
|
|
443
|
-
--max-compress Apply maximum PNG compression (preserves metadata)
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
#### **Frame Extraction Options (v0.6.8+)**
|
|
447
|
-
```bash
|
|
448
|
-
--extract FRAMES Extract specific frames by number (e.g., 1,2,4,5,8)
|
|
449
|
-
--columns NUM Output grid columns for extracted spritesheet (default: 4)
|
|
450
|
-
--save-frames Keep individual extracted frames on disk
|
|
451
|
-
--split R:C Split spritesheet into all individual frames (rows:columns)
|
|
452
|
-
--override-md Override embedded metadata when using --split
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
#### **Metadata Management Options (v0.6.8+)**
|
|
456
|
-
```bash
|
|
457
|
-
--add-meta R:C Add spritesheet metadata (rows:columns, e.g., 4:4)
|
|
458
|
-
--overwrite-meta Replace existing metadata
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
#### **Other Options**
|
|
462
|
-
```bash
|
|
463
|
-
--overwrite Overwrite existing output files (default: create unique filenames)
|
|
464
|
-
--keep-temp Keep temporary files for debugging
|
|
465
|
-
--debug Enable verbose output + keep temp files
|
|
466
|
-
--check-dependencies Check if all required external tools are installed
|
|
467
|
-
--version Show version information
|
|
468
|
-
-h, --help Show help message
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
## 💡 Use Cases
|
|
474
|
-
|
|
475
|
-
### Game Development with Godot
|
|
476
|
-
|
|
477
|
-
#### Character Animation Sprites
|
|
478
|
-
```bash
|
|
479
|
-
# Export from Blender/animation software to MP4
|
|
480
|
-
# Convert to optimized spritesheet with background removal
|
|
481
|
-
|
|
482
|
-
ruby_spriter --video character_walk.mp4 \
|
|
483
|
-
--frames 16 --columns 4 \
|
|
484
|
-
--scale 50 --remove-bg \
|
|
485
|
-
--sharpen
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
#### VFX and Particle Effects
|
|
489
|
-
```bash
|
|
490
|
-
# High frame count for smooth effects
|
|
491
|
-
ruby_spriter --video explosion.mp4 \
|
|
492
|
-
--frames 64 --columns 8 \
|
|
493
|
-
--scale 75 --interpolation nohalo
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
#### Multiple Character Directions
|
|
497
|
-
```bash
|
|
498
|
-
# Consolidate walk cycles for 8 directions (file list)
|
|
499
|
-
ruby_spriter --consolidate \
|
|
500
|
-
walk_n.png,walk_ne.png,walk_e.png,walk_se.png,\
|
|
501
|
-
walk_s.png,walk_sw.png,walk_w.png,walk_nw.png \
|
|
502
|
-
--output character_walk_all.png
|
|
503
|
-
|
|
504
|
-
# Or consolidate all spritesheets in a directory (v0.6.7+)
|
|
505
|
-
ruby_spriter --consolidate --dir "walk_cycles/" \
|
|
506
|
-
--output character_walk_all.png
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
### Batch Processing Workflows (v0.6.7+)
|
|
510
|
-
```bash
|
|
511
|
-
# Process entire animation library
|
|
512
|
-
ruby_spriter --batch --dir "raw_animations/" \
|
|
513
|
-
--outputdir "game_assets/sprites/" \
|
|
514
|
-
--scale 50 --remove-bg --sharpen --max-compress
|
|
515
|
-
|
|
516
|
-
# Create and consolidate multiple character states
|
|
517
|
-
ruby_spriter --batch --dir "character_states/" \
|
|
518
|
-
--frames 8 --columns 4 \
|
|
519
|
-
--batch-consolidate
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
### Quality Enhancement
|
|
523
|
-
```bash
|
|
524
|
-
# Downscale high-res renders while maintaining sharpness
|
|
525
|
-
ruby_spriter --image 4k_sprite.png \
|
|
526
|
-
--scale 25 --interpolation lohalo \
|
|
527
|
-
--sharpen --sharpen-gain 1.0 \
|
|
528
|
-
--max-compress \
|
|
529
|
-
--output hd_sprite.png
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
## 🔧 Advanced Features
|
|
535
|
-
|
|
536
|
-
### Batch Processing (v0.6.7+)
|
|
537
|
-
|
|
538
|
-
Process entire directories of MP4 files with consistent settings:
|
|
539
|
-
|
|
540
|
-
```bash
|
|
541
|
-
# Basic batch processing
|
|
542
|
-
ruby_spriter --batch --dir "animations/"
|
|
543
|
-
# Processes all MP4s with default 4x4 grid
|
|
544
|
-
|
|
545
|
-
# Batch with processing options
|
|
546
|
-
ruby_spriter --batch --dir "animations/" \
|
|
547
|
-
--frames 32 --columns 8 \
|
|
548
|
-
--scale 50 --remove-bg --sharpen \
|
|
549
|
-
--max-compress
|
|
550
|
-
|
|
551
|
-
# Batch with output directory
|
|
552
|
-
ruby_spriter --batch --dir "raw_videos/" \
|
|
553
|
-
--outputdir "game_assets/sprites/"
|
|
554
|
-
|
|
555
|
-
# Batch and consolidate results
|
|
556
|
-
ruby_spriter --batch --dir "character_states/" \
|
|
557
|
-
--batch-consolidate \
|
|
558
|
-
--output character_complete.png
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
**Features:**
|
|
562
|
-
- Automatically finds all MP4 files in directory
|
|
563
|
-
- Applies consistent processing to all videos
|
|
564
|
-
- Enforces unique output filenames (unless `--overwrite`)
|
|
565
|
-
- Continues processing if one file fails
|
|
566
|
-
- Optional consolidation of all results
|
|
567
|
-
- Supports all video and image processing options
|
|
568
|
-
|
|
569
|
-
### Maximum Compression (v0.6.7+)
|
|
570
|
-
|
|
571
|
-
Reduce file sizes while preserving metadata:
|
|
572
|
-
|
|
573
|
-
```bash
|
|
574
|
-
# Compress during video processing
|
|
575
|
-
ruby_spriter --video input.mp4 --max-compress
|
|
576
|
-
|
|
577
|
-
# Compress during image processing
|
|
578
|
-
ruby_spriter --image sprite.png --scale 50 --max-compress
|
|
579
|
-
|
|
580
|
-
# Compress batch output
|
|
581
|
-
ruby_spriter --batch --dir "videos/" --max-compress
|
|
582
|
-
|
|
583
|
-
# Compress consolidated output
|
|
584
|
-
ruby_spriter --consolidate --dir "sprites/" --max-compress
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
**Compression Details:**
|
|
588
|
-
- Uses ImageMagick optimal PNG compression settings
|
|
589
|
-
- Compression level 9 (maximum zlib)
|
|
590
|
-
- Paeth filter (compression filter 5)
|
|
591
|
-
- Filtered strategy (compression strategy 1)
|
|
592
|
-
- Quality 95
|
|
593
|
-
- Preserves embedded spritesheet metadata
|
|
594
|
-
- Displays size reduction statistics
|
|
595
|
-
|
|
596
|
-
### Directory-Based Consolidation (v0.6.7+)
|
|
597
|
-
|
|
598
|
-
Consolidate all spritesheets in a directory automatically:
|
|
599
|
-
|
|
600
|
-
```bash
|
|
601
|
-
# Scan directory and consolidate all spritesheets
|
|
602
|
-
ruby_spriter --consolidate --dir "character_animations/"
|
|
603
|
-
|
|
604
|
-
# With output directory
|
|
605
|
-
ruby_spriter --consolidate --dir "sprites/" \
|
|
606
|
-
--outputdir "final_assets/"
|
|
607
|
-
|
|
608
|
-
# With compression
|
|
609
|
-
ruby_spriter --consolidate --dir "sprites/" \
|
|
610
|
-
--max-compress \
|
|
611
|
-
--output character_complete.png
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
**Directory Mode Features:**
|
|
615
|
-
- Automatically scans for PNG files with metadata
|
|
616
|
-
- Filters out non-spritesheet images
|
|
617
|
-
- Sorts files alphabetically before consolidation
|
|
618
|
-
- Requires at least 2 valid spritesheets
|
|
619
|
-
- Cannot mix with comma-separated file list mode
|
|
620
|
-
|
|
621
|
-
### File Protection with Unique Filenames (v0.6.6+)
|
|
622
|
-
|
|
623
|
-
By default, Ruby Spriter protects your existing files by generating unique timestamped filenames when output files already exist:
|
|
624
|
-
|
|
625
|
-
```bash
|
|
626
|
-
# First run - creates new file
|
|
627
|
-
ruby_spriter --image sprite.png --remove-bg
|
|
628
|
-
# Output: sprite-nobg-fuzzy.png
|
|
629
|
-
|
|
630
|
-
# Second run - creates unique file instead of overwriting
|
|
631
|
-
ruby_spriter --image sprite.png --remove-bg
|
|
632
|
-
# Output: sprite-nobg-fuzzy_20251023_170542_123.png
|
|
633
|
-
|
|
634
|
-
# Third run - another unique file
|
|
635
|
-
ruby_spriter --image sprite.png --remove-bg
|
|
636
|
-
# Output: sprite-nobg-fuzzy_20251023_170545_456.png
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
#### Overwrite Mode
|
|
640
|
-
|
|
641
|
-
Use `--overwrite` to replace existing files instead:
|
|
642
|
-
|
|
643
|
-
```bash
|
|
644
|
-
# Always overwrites sprite-nobg-fuzzy.png
|
|
645
|
-
ruby_spriter --image sprite.png --remove-bg --overwrite
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
#### Behavior by Mode
|
|
649
|
-
|
|
650
|
-
| Mode | Default Filename | Unique on Collision |
|
|
651
|
-
|------|------------------|---------------------|
|
|
652
|
-
| `--video` | `input_spritesheet.png` | ✅ Yes |
|
|
653
|
-
| `--image` (with processing) | `input-scaled-50pct.png` | ✅ Yes |
|
|
654
|
-
| `--consolidate` | `consolidated_spritesheet.png` | ✅ Yes |
|
|
655
|
-
| Any with `--output` | Your specified name | ✅ Yes (unless `--overwrite`) |
|
|
656
|
-
|
|
657
|
-
### Metadata Management
|
|
658
|
-
|
|
659
|
-
Ruby Spriter embeds grid information directly into PNG files:
|
|
660
|
-
|
|
661
|
-
```bash
|
|
662
|
-
# Metadata is automatically embedded during creation
|
|
663
|
-
ruby_spriter --video input.mp4 --frames 32 --columns 8
|
|
664
|
-
|
|
665
|
-
# Verify metadata in existing spritesheet
|
|
666
|
-
ruby_spriter --verify spritesheet.png
|
|
667
|
-
|
|
668
|
-
# Output:
|
|
669
|
-
# Spritesheet Metadata Verification
|
|
670
|
-
# ================================
|
|
671
|
-
# File: spritesheet.png
|
|
672
|
-
# Columns: 8
|
|
673
|
-
# Frames: 32
|
|
674
|
-
# Rows: 4 (calculated)
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
### Operation Order Optimization
|
|
678
|
-
|
|
679
|
-
When both scaling and background removal are requested, Ruby Spriter automatically uses the optimal order:
|
|
680
|
-
|
|
681
|
-
```bash
|
|
682
|
-
# This automatically removes background BEFORE scaling
|
|
683
|
-
ruby_spriter --video input.mp4 --scale 50 --remove-bg
|
|
684
|
-
|
|
685
|
-
# Why? Background removal works better at full resolution,
|
|
686
|
-
# then scaling smooths any rough edges
|
|
687
|
-
```
|
|
688
|
-
|
|
689
|
-
Override if needed:
|
|
690
|
-
```bash
|
|
691
|
-
ruby_spriter --video input.mp4 --scale 50 --remove-bg --order scale_first
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
### Debug Mode
|
|
695
|
-
|
|
696
|
-
```bash
|
|
697
|
-
# See exactly what's happening
|
|
698
|
-
ruby_spriter --video input.mp4 --scale 50 --sharpen --debug
|
|
699
|
-
|
|
700
|
-
# Output includes:
|
|
701
|
-
# - Dependency check results
|
|
702
|
-
# - Temp directory location
|
|
703
|
-
# - GIMP script paths and logs
|
|
704
|
-
# - ImageMagick commands
|
|
705
|
-
# - Processing timestamps
|
|
706
|
-
```
|
|
707
|
-
|
|
708
|
-
### Headless Linux Operation (v0.6.7.1+)
|
|
709
|
-
|
|
710
|
-
Ruby Spriter provides completely headless GIMP operation on Linux via Xvfb and Flatpak socket isolation:
|
|
711
|
-
|
|
712
|
-
```bash
|
|
713
|
-
# No GIMP GUI appears during processing
|
|
714
|
-
ruby_spriter --image sprite.png --remove-bg --scale 50
|
|
715
|
-
|
|
716
|
-
# Perfect for server environments
|
|
717
|
-
ruby_spriter --batch --dir "sprites/" --remove-bg --max-compress
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
**How it Works:**
|
|
721
|
-
- Automatically detects GIMP 3.x Flatpak installation
|
|
722
|
-
- Uses Xvfb (X Virtual Framebuffer) to provide virtual display
|
|
723
|
-
- Flatpak socket isolation (`--nosocket=x11 --nosocket=wayland`) prevents GUI from appearing
|
|
724
|
-
- No configuration required - works automatically
|
|
725
|
-
|
|
726
|
-
**Use Cases:**
|
|
727
|
-
- **Desktop**: No GUI distractions during batch processing
|
|
728
|
-
- **Server**: Headless automation on Ubuntu Server, CI/CD pipelines
|
|
729
|
-
- **Docker**: Run in containers without display server
|
|
730
|
-
- **SSH**: Process sprites remotely without X forwarding
|
|
731
|
-
|
|
732
|
-
**Requirements:**
|
|
733
|
-
- GIMP 3.x via Flatpak (`flatpak install flathub org.gimp.GIMP`)
|
|
734
|
-
- Xvfb (`sudo apt install xvfb` on Ubuntu/Debian)
|
|
735
|
-
|
|
736
|
-
---
|
|
737
|
-
|
|
738
|
-
## 🏗️ Architecture
|
|
739
|
-
|
|
740
|
-
### Five Processing Modes
|
|
741
|
-
|
|
742
|
-
1. **Video Mode** - MP4 → Spritesheet → Optional Processing
|
|
743
|
-
2. **Image Mode** - PNG → Processing → Enhanced PNG
|
|
744
|
-
3. **Consolidate Mode** - Multiple PNGs → Combined Spritesheet (file list or directory)
|
|
745
|
-
4. **Batch Mode** (v0.6.7+) - Directory of MP4s → Multiple Spritesheets → Optional Consolidation
|
|
746
|
-
5. **Verify Mode** - Read and display embedded metadata
|
|
747
|
-
|
|
748
|
-
### Processing Pipeline
|
|
749
|
-
|
|
750
|
-
**Video Mode:**
|
|
751
|
-
```
|
|
752
|
-
Input Video (MP4)
|
|
753
|
-
↓
|
|
754
|
-
[FFmpeg] Frame Extraction + Spritesheet Assembly
|
|
755
|
-
↓
|
|
756
|
-
[ImageMagick] Metadata Embedding
|
|
757
|
-
↓
|
|
758
|
-
[GIMP] Scale and/or Background Removal (optional)
|
|
759
|
-
↓
|
|
760
|
-
[ImageMagick] Sharpening (optional)
|
|
761
|
-
↓
|
|
762
|
-
Output PNG with Metadata
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
**Image Mode:**
|
|
766
|
-
```
|
|
767
|
-
Input Image (PNG)
|
|
768
|
-
↓
|
|
769
|
-
[GIMP] Scale and/or Background Removal (optional)
|
|
770
|
-
↓
|
|
771
|
-
[ImageMagick] Sharpening (optional)
|
|
772
|
-
↓
|
|
773
|
-
[ImageMagick] Metadata Preservation
|
|
774
|
-
↓
|
|
775
|
-
Output PNG with Metadata
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
**Consolidate Mode:**
|
|
779
|
-
```
|
|
780
|
-
Multiple Input PNGs (file list or directory scan)
|
|
781
|
-
↓
|
|
782
|
-
[Metadata Filter] Find PNGs with spritesheet metadata (directory mode)
|
|
783
|
-
↓
|
|
784
|
-
[ImageMagick] Read Metadata from Each
|
|
785
|
-
↓
|
|
786
|
-
[ImageMagick] Validate Column Compatibility
|
|
787
|
-
↓
|
|
788
|
-
[ImageMagick] Vertical Stacking (append)
|
|
789
|
-
↓
|
|
790
|
-
[ImageMagick] Embed Combined Metadata
|
|
791
|
-
↓
|
|
792
|
-
[ImageMagick] Optional Max Compression
|
|
793
|
-
↓
|
|
794
|
-
Output Consolidated PNG
|
|
795
|
-
```
|
|
796
|
-
|
|
797
|
-
**Batch Mode (v0.6.7+):**
|
|
798
|
-
```
|
|
799
|
-
Directory of MP4 Files
|
|
800
|
-
↓
|
|
801
|
-
[Scan] Find all MP4 files
|
|
802
|
-
↓
|
|
803
|
-
[Loop] For each MP4:
|
|
804
|
-
├─ [FFmpeg] Extract frames + create spritesheet
|
|
805
|
-
├─ [GIMP] Optional scaling/background removal
|
|
806
|
-
├─ [ImageMagick] Optional sharpening
|
|
807
|
-
└─ [ImageMagick] Optional max compression
|
|
808
|
-
↓
|
|
809
|
-
[Optional] Consolidate all results with --batch-consolidate
|
|
810
|
-
↓
|
|
811
|
-
Multiple Output PNGs (or one consolidated PNG)
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
### Key Components
|
|
815
|
-
|
|
816
|
-
- **Processor** - Main orchestration
|
|
817
|
-
- **VideoProcessor** - FFmpeg integration
|
|
818
|
-
- **GimpProcessor** - GIMP batch scripting
|
|
819
|
-
- **Consolidator** - Multi-sheet merging (file list or directory)
|
|
820
|
-
- **BatchProcessor** (v0.6.7+) - Directory batch processing
|
|
821
|
-
- **CompressionManager** (v0.6.7+) - PNG compression with metadata preservation
|
|
822
|
-
- **MetadataManager** - PNG metadata handling
|
|
823
|
-
- **DependencyChecker** - Tool detection
|
|
824
|
-
- **Platform** - Cross-platform abstraction
|
|
825
|
-
|
|
826
|
-
---
|
|
827
|
-
|
|
828
|
-
## 🧪 Development
|
|
829
|
-
|
|
830
|
-
### Setup Development Environment
|
|
831
|
-
|
|
832
|
-
```bash
|
|
833
|
-
# Clone and setup
|
|
834
|
-
git clone https://github.com/scooter-indie/ruby-spriter.git
|
|
835
|
-
cd ruby-spriter
|
|
836
|
-
bundle install
|
|
837
|
-
|
|
838
|
-
# Run tests
|
|
839
|
-
bundle exec rspec
|
|
840
|
-
|
|
841
|
-
# Run specific test
|
|
842
|
-
bundle exec rspec spec/ruby_spriter/processor_spec.rb
|
|
843
|
-
|
|
844
|
-
# Check code coverage
|
|
845
|
-
bundle exec rspec
|
|
846
|
-
# Opens coverage/index.html
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
### Project Structure
|
|
850
|
-
|
|
851
|
-
```
|
|
852
|
-
ruby-spriter/
|
|
853
|
-
├── bin/
|
|
854
|
-
│ └── ruby_spriter # CLI executable
|
|
855
|
-
├── lib/
|
|
856
|
-
│ └── ruby_spriter/
|
|
857
|
-
│ ├── cli.rb # Command-line interface
|
|
858
|
-
│ ├── processor.rb # Main orchestration
|
|
859
|
-
│ ├── video_processor.rb
|
|
860
|
-
│ ├── gimp_processor.rb
|
|
861
|
-
│ ├── consolidator.rb
|
|
862
|
-
│ ├── batch_processor.rb # v0.6.7+
|
|
863
|
-
│ ├── compression_manager.rb # v0.6.7+
|
|
864
|
-
│ ├── metadata_manager.rb
|
|
865
|
-
│ ├── dependency_checker.rb
|
|
866
|
-
│ ├── platform.rb
|
|
867
|
-
│ └── utils/ # Helper modules
|
|
868
|
-
├── spec/ # RSpec tests (313 examples)
|
|
869
|
-
├── .claude/
|
|
870
|
-
│ └── agents/ # Custom Claude Code agent config
|
|
871
|
-
├── CLAUDE.md # Developer documentation
|
|
872
|
-
├── CHANGELOG.md # Version history
|
|
873
|
-
└── README.md # This file
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
### Running from Source
|
|
877
|
-
|
|
878
|
-
```bash
|
|
879
|
-
# Without installing gem
|
|
880
|
-
ruby -Ilib bin/ruby_spriter --video test.mp4
|
|
881
|
-
|
|
882
|
-
# Or use bundle exec
|
|
883
|
-
bundle exec ruby_spriter --video test.mp4
|
|
884
|
-
```
|
|
885
|
-
|
|
886
|
-
---
|
|
887
|
-
|
|
888
|
-
## 🤝 Contributing
|
|
889
|
-
|
|
890
|
-
Contributions are welcome! This project follows strict **Test-Driven Development (TDD)** practices.
|
|
891
|
-
|
|
892
|
-
### Development Workflow
|
|
893
|
-
|
|
894
|
-
1. **Fork the repository**
|
|
895
|
-
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
|
896
|
-
3. **Follow TDD Red-Green-Refactor cycle:**
|
|
897
|
-
- ✅ **Red**: Write ONE test → Run it → Verify it FAILS
|
|
898
|
-
- ✅ **Green**: Write minimal code → Run test → Verify it PASSES
|
|
899
|
-
- ✅ **Refactor**: Clean up → Run all tests → Verify still passing
|
|
900
|
-
- ✅ **Repeat** for each new test
|
|
901
|
-
4. **Ensure all tests pass** (`bundle exec rspec`)
|
|
902
|
-
5. **Update documentation** (README.md, CHANGELOG.md, CLAUDE.md)
|
|
903
|
-
6. **Commit your changes** (`git commit -m 'Add amazing feature'`)
|
|
904
|
-
7. **Push to the branch** (`git push origin feature/amazing-feature`)
|
|
905
|
-
8. **Open a Pull Request**
|
|
906
|
-
|
|
907
|
-
### Agent Configuration
|
|
908
|
-
|
|
909
|
-
This project includes a custom Claude Code agent (`.claude/agents/ruby-spriter-architect.md`) that enforces:
|
|
910
|
-
- Strict TDD (Red-Green-Refactor) workflow
|
|
911
|
-
- Architecture consistency
|
|
912
|
-
- Documentation maintenance
|
|
913
|
-
- Cross-platform compatibility
|
|
914
|
-
- Test coverage requirements
|
|
915
|
-
|
|
916
|
-
The agent configuration is version-controlled and shared across the team.
|
|
917
|
-
|
|
918
|
-
---
|
|
919
|
-
|
|
920
|
-
## 📄 License
|
|
921
|
-
|
|
922
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
923
|
-
|
|
924
|
-
---
|
|
925
|
-
|
|
926
|
-
## 🔗 Links
|
|
927
|
-
|
|
928
|
-
- **GitHub**: [https://github.com/scooter-indie/ruby-spriter](https://github.com/scooter-indie/ruby-spriter)
|
|
929
|
-
- **Issues**: [https://github.com/scooter-indie/ruby-spriter/issues](https://github.com/scooter-indie/ruby-spriter/issues)
|
|
930
|
-
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
931
|
-
|
|
932
|
-
---
|
|
933
|
-
|
|
934
|
-
## 🙏 Acknowledgments
|
|
935
|
-
|
|
936
|
-
- **FFmpeg** - Video processing foundation
|
|
937
|
-
- **GIMP** - Professional image manipulation
|
|
938
|
-
- **ImageMagick** - Metadata and image operations
|
|
939
|
-
- **Ruby Community** - Excellent standard library
|
|
940
|
-
|
|
941
|
-
---
|
|
942
|
-
|
|
943
|
-
## 📖 See Also
|
|
944
|
-
|
|
945
|
-
- [CLAUDE.md](CLAUDE.md) - Detailed developer documentation and architecture guide
|
|
946
|
-
- [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
|
|
947
|
-
|
|
948
|
-
---
|
|
949
|
-
|
|
950
|
-
**Made with ❤️ for game developers**
|
|
1
|
+
# Ruby Spriter v0.7.0.1
|
|
2
|
+
|
|
3
|
+
[](https://www.ruby-lang.org/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[]()
|
|
6
|
+
|
|
7
|
+
**Professional MP4 to Spritesheet Converter with Advanced Image Processing**
|
|
8
|
+
|
|
9
|
+
A powerful cross-platform Ruby tool for creating high-quality spritesheets from video files and processing them with professional-grade image manipulation. Perfect for game development workflows, particularly with Godot Engine.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ✨ Key Features
|
|
14
|
+
|
|
15
|
+
- 🎬 **Video to Spritesheet** - Extract frames from MP4 videos using FFmpeg
|
|
16
|
+
- 🖼️ **Advanced Image Processing** - Scale, sharpen, and remove backgrounds with precision
|
|
17
|
+
- 🎨 **Quality Enhancement** - 5 interpolation methods and configurable unsharp masking
|
|
18
|
+
- 🎞️ **Frame-by-Frame Processing** - Process each video frame individually for varying backgrounds (v0.7.0.1+)
|
|
19
|
+
- 📐 **Spritesheet Consolidation** - Merge multiple spritesheets vertically
|
|
20
|
+
- 📊 **Metadata Management** - Embed, verify, and add grid information to PNG files
|
|
21
|
+
- 📦 **Batch Processing** - Process multiple MP4 files in a directory automatically (v0.6.7+)
|
|
22
|
+
- 🗜️ **Maximum Compression** - Optimal PNG compression while preserving metadata (v0.6.7+)
|
|
23
|
+
- 🌍 **Cross-Platform** - Works seamlessly on Windows, Linux, and macOS
|
|
24
|
+
- 🧪 **Production Ready** - Comprehensive RSpec test coverage (512+ tests)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
### Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
gem install ruby_spriter
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Verify Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
ruby_spriter --check-dependencies
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Basic Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Create 4x4 grid with 16 frames
|
|
46
|
+
ruby_spriter --video input.mp4
|
|
47
|
+
|
|
48
|
+
# Remove background
|
|
49
|
+
ruby_spriter --video input.mp4 --remove-bg
|
|
50
|
+
|
|
51
|
+
# Scale and compress
|
|
52
|
+
ruby_spriter --video input.mp4 --scale 50 --max-compress
|
|
53
|
+
|
|
54
|
+
# Batch process entire directory
|
|
55
|
+
ruby_spriter --batch --dir "videos/" --remove-bg
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 📚 Documentation
|
|
61
|
+
|
|
62
|
+
Complete documentation is organized into focused guides:
|
|
63
|
+
|
|
64
|
+
| Guide | Purpose |
|
|
65
|
+
|-------|---------|
|
|
66
|
+
| **[Installation Guide](docs/INSTALLATION.md)** | Prerequisites, installation methods, and verification |
|
|
67
|
+
| **[Usage Reference](docs/USAGE.md)** | Complete CLI options and command examples |
|
|
68
|
+
| **[Features Overview](docs/FEATURES.md)** | All capabilities and image processing features |
|
|
69
|
+
| **[Advanced Features](docs/ADVANCED.md)** | Batch processing, compression, consolidation, etc. |
|
|
70
|
+
| **[Architecture Guide](docs/ARCHITECTURE.md)** | System design, processing pipelines, components |
|
|
71
|
+
| **[Development Guide](docs/DEVELOPMENT.md)** | Contributing, testing, and development setup |
|
|
72
|
+
| **[Use Cases & Examples](docs/USE_CASES.md)** | Real-world scenarios and game development workflows |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📋 Requirements
|
|
77
|
+
|
|
78
|
+
### External Dependencies
|
|
79
|
+
|
|
80
|
+
| Tool | Purpose |
|
|
81
|
+
|------|---------|
|
|
82
|
+
| **FFmpeg** | Video frame extraction |
|
|
83
|
+
| **ImageMagick** | Metadata and image processing |
|
|
84
|
+
| **GIMP** | Advanced scaling and background removal |
|
|
85
|
+
| **Xvfb** | Virtual display (Linux only) |
|
|
86
|
+
|
|
87
|
+
### Ruby Version
|
|
88
|
+
|
|
89
|
+
- Ruby 2.7.0 or higher
|
|
90
|
+
- No runtime gem dependencies (uses Ruby standard library)
|
|
91
|
+
|
|
92
|
+
### Supported Formats
|
|
93
|
+
|
|
94
|
+
- **Video Input**: MP4 only
|
|
95
|
+
- **Image Input/Output**: PNG only
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 💡 Common Workflows
|
|
100
|
+
|
|
101
|
+
### Game Development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Character animation for Godot
|
|
105
|
+
ruby_spriter --video character_walk.mp4 \
|
|
106
|
+
--frames 16 --columns 4 \
|
|
107
|
+
--scale 50 --remove-bg --sharpen
|
|
108
|
+
|
|
109
|
+
# VFX effects with high frame count
|
|
110
|
+
ruby_spriter --video explosion.mp4 \
|
|
111
|
+
--frames 64 --columns 8 \
|
|
112
|
+
--scale 75 --interpolation nohalo
|
|
113
|
+
|
|
114
|
+
# Consolidate 8-directional walk cycles
|
|
115
|
+
ruby_spriter --consolidate --dir "walk_cycles/" \
|
|
116
|
+
--output character_walk_all.png
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Batch Processing
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Process entire animation library
|
|
123
|
+
ruby_spriter --batch --dir "raw_animations/" \
|
|
124
|
+
--outputdir "game_assets/" \
|
|
125
|
+
--scale 50 --remove-bg --max-compress
|
|
126
|
+
|
|
127
|
+
# Batch with consolidation
|
|
128
|
+
ruby_spriter --batch --dir "states/" \
|
|
129
|
+
--batch-consolidate --output character_all.png
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Varying Backgrounds
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Frame-by-frame for videos with changing backgrounds
|
|
136
|
+
ruby_spriter --video animation.mp4 \
|
|
137
|
+
--remove-bg --by-frame \
|
|
138
|
+
--frames 32 --columns 8
|
|
139
|
+
|
|
140
|
+
# Batch process with frame-by-frame
|
|
141
|
+
ruby_spriter --batch --dir "animations/" \
|
|
142
|
+
--remove-bg --by-frame --scale 50
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 🔧 Advanced Features
|
|
148
|
+
|
|
149
|
+
- **Inner Background Removal** - Remove interior background regions (v0.7.0+)
|
|
150
|
+
- **Threshold Stepping** - Process with multiple thresholds for superior edges (v0.7.0+)
|
|
151
|
+
- **Ghost Edge Prevention** - Multi-pass cleanup of semi-transparent artifacts (v0.7.0+)
|
|
152
|
+
- **Smoke Detection** - Identify and remove transparency gradients (v0.7.0+)
|
|
153
|
+
- **Frame Extraction** - Extract specific frames by number (v0.7.0+)
|
|
154
|
+
- **Metadata Addition** - Add grid information to external spritesheets (v0.7.0+)
|
|
155
|
+
- **Cell-Based Cleanup** - Post-process residual backgrounds per-cell (v0.7.0.1+, experimental)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 📄 License
|
|
160
|
+
|
|
161
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🔗 Links
|
|
166
|
+
|
|
167
|
+
- **GitHub**: [https://github.com/scooter-indie/ruby-spriter](https://github.com/scooter-indie/ruby-spriter)
|
|
168
|
+
- **Issues**: [https://github.com/scooter-indie/ruby-spriter/issues](https://github.com/scooter-indie/ruby-spriter/issues)
|
|
169
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
170
|
+
- **Developer Docs**: [CLAUDE.md](CLAUDE.md)
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🙏 Acknowledgments
|
|
175
|
+
|
|
176
|
+
- **FFmpeg** - Video processing foundation
|
|
177
|
+
- **GIMP** - Professional image manipulation
|
|
178
|
+
- **ImageMagick** - Metadata and image operations
|
|
179
|
+
- **Ruby Community** - Excellent standard library
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
**Made with ❤️ for game developers**
|