ruby_spriter 0.6.5 โ 0.6.7
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/CHANGELOG.md +188 -0
- data/README.md +374 -33
- data/lib/ruby_spriter/batch_processor.rb +212 -0
- data/lib/ruby_spriter/cli.rb +369 -6
- data/lib/ruby_spriter/compression_manager.rb +101 -0
- data/lib/ruby_spriter/consolidator.rb +33 -0
- data/lib/ruby_spriter/gimp_processor.rb +6 -3
- data/lib/ruby_spriter/processor.rb +661 -26
- data/lib/ruby_spriter/utils/file_helper.rb +25 -0
- data/lib/ruby_spriter/utils/spritesheet_splitter.rb +86 -0
- data/lib/ruby_spriter/version.rb +2 -2
- data/lib/ruby_spriter/video_processor.rb +7 -7
- data/lib/ruby_spriter.rb +3 -0
- data/spec/ruby_spriter/batch_processor_spec.rb +200 -0
- data/spec/ruby_spriter/cli_spec.rb +750 -0
- data/spec/ruby_spriter/compression_manager_spec.rb +157 -0
- data/spec/ruby_spriter/consolidator_spec.rb +163 -0
- data/spec/ruby_spriter/processor_spec.rb +735 -0
- data/spec/ruby_spriter/utils/file_helper_spec.rb +80 -1
- data/spec/ruby_spriter/utils/spritesheet_splitter_spec.rb +104 -0
- data/spec/ruby_spriter/video_processor_spec.rb +29 -0
- metadata +8 -2
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Ruby Spriter v0.6.
|
|
1
|
+
# Ruby Spriter v0.6.7
|
|
2
2
|
|
|
3
3
|
[](https://www.ruby-lang.org/)
|
|
4
4
|
[](LICENSE)
|
|
@@ -16,10 +16,15 @@ A powerful cross-platform Ruby tool for creating high-quality spritesheets from
|
|
|
16
16
|
- ๐ฌ **Video to Spritesheet** - Extract frames from MP4 videos using FFmpeg
|
|
17
17
|
- ๐ผ๏ธ **Advanced Image Processing** - Scale, sharpen, and remove backgrounds with precision
|
|
18
18
|
- ๐จ **Quality Enhancement** - 5 interpolation methods and configurable unsharp masking
|
|
19
|
-
- ๐ **Spritesheet Consolidation** - Merge multiple spritesheets vertically
|
|
20
|
-
- ๐ **Metadata Management** - Embed and
|
|
19
|
+
- ๐ **Spritesheet Consolidation** - Merge multiple spritesheets vertically (file list or directory)
|
|
20
|
+
- ๐ **Metadata Management** - Embed, verify, and add grid information to PNG files
|
|
21
|
+
- ๐ฏ **Frame Extraction** - Extract specific frames by number and create new spritesheets
|
|
22
|
+
- ๐ท๏ธ **Metadata Addition** - Add spritesheet metadata to external images
|
|
23
|
+
- ๐ **Automatic File Protection** - Unique timestamped filenames prevent accidental overwrites (v0.6.6+)
|
|
24
|
+
- ๐ฆ **Batch Processing** - Process multiple MP4 files in a directory automatically (v0.6.7+)
|
|
25
|
+
- ๐๏ธ **Maximum Compression** - Optimal PNG compression while preserving metadata (v0.6.7+)
|
|
21
26
|
- ๐ **Cross-Platform** - Works seamlessly on Windows, Linux, and macOS
|
|
22
|
-
- ๐งช **Production Ready** - Comprehensive RSpec test coverage
|
|
27
|
+
- ๐งช **Production Ready** - Comprehensive RSpec test coverage (365 tests)
|
|
23
28
|
|
|
24
29
|
### Image Processing Features
|
|
25
30
|
|
|
@@ -88,19 +93,82 @@ Ruby Spriter requires these external tools for video and image processing:
|
|
|
88
93
|
|
|
89
94
|
#### Installing Prerequisites
|
|
90
95
|
|
|
91
|
-
**Windows (Chocolatey)**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
**Windows (Chocolatey - Recommended)**
|
|
97
|
+
|
|
98
|
+
Chocolatey is a package manager for Windows that simplifies software installation. If you don't have Chocolatey installed:
|
|
99
|
+
|
|
100
|
+
1. **Install Chocolatey** (run PowerShell as Administrator):
|
|
101
|
+
```powershell
|
|
102
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Verify installation:
|
|
106
|
+
```powershell
|
|
107
|
+
choco --version
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
2. **Install Ruby** (if not already installed):
|
|
111
|
+
```powershell
|
|
112
|
+
choco install ruby -y
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Close and reopen PowerShell, then verify:
|
|
116
|
+
```powershell
|
|
117
|
+
ruby --version
|
|
118
|
+
gem --version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
3. **Install Ruby Spriter dependencies**:
|
|
122
|
+
```powershell
|
|
123
|
+
choco install ffmpeg imagemagick gimp -y
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This installs all required tools:
|
|
127
|
+
- **FFmpeg** - Video processing
|
|
128
|
+
- **ImageMagick** - Image manipulation and metadata
|
|
129
|
+
- **GIMP** - Advanced image processing
|
|
130
|
+
|
|
131
|
+
4. **Restart your terminal** to ensure all tools are in your PATH
|
|
132
|
+
|
|
133
|
+
**Alternative: Manual Installation on Windows**
|
|
134
|
+
|
|
135
|
+
If you prefer not to use Chocolatey:
|
|
136
|
+
- **Ruby**: Download from [rubyinstaller.org](https://rubyinstaller.org/)
|
|
137
|
+
- **FFmpeg**: Download from [ffmpeg.org](https://ffmpeg.org/download.html)
|
|
138
|
+
- **ImageMagick**: Download from [imagemagick.org](https://imagemagick.org/script/download.php#windows)
|
|
139
|
+
- **GIMP**: Download from [gimp.org](https://www.gimp.org/downloads/)
|
|
95
140
|
|
|
96
141
|
**macOS (Homebrew)**
|
|
142
|
+
|
|
97
143
|
```bash
|
|
144
|
+
# Install Homebrew if not already installed
|
|
145
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
146
|
+
|
|
147
|
+
# Install Ruby (if not already installed)
|
|
148
|
+
brew install ruby
|
|
149
|
+
|
|
150
|
+
# Install Ruby Spriter dependencies
|
|
98
151
|
brew install ffmpeg imagemagick gimp
|
|
99
152
|
```
|
|
100
153
|
|
|
101
154
|
**Linux (Ubuntu/Debian)**
|
|
155
|
+
|
|
102
156
|
```bash
|
|
103
|
-
|
|
157
|
+
# Install Ruby (if not already installed)
|
|
158
|
+
sudo apt update && sudo apt install ruby-full -y
|
|
159
|
+
|
|
160
|
+
# Install Ruby Spriter dependencies
|
|
161
|
+
sudo apt install ffmpeg imagemagick gimp -y
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Linux (Fedora/RHEL)**
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Install Ruby (if not already installed)
|
|
168
|
+
sudo dnf install ruby -y
|
|
169
|
+
|
|
170
|
+
# Install Ruby Spriter dependencies
|
|
171
|
+
sudo dnf install ffmpeg imagemagick gimp -y
|
|
104
172
|
```
|
|
105
173
|
|
|
106
174
|
---
|
|
@@ -134,7 +202,7 @@ bundle install
|
|
|
134
202
|
|
|
135
203
|
# Build and install gem locally
|
|
136
204
|
gem build ruby_spriter.gemspec
|
|
137
|
-
gem install ruby_spriter-0.6.
|
|
205
|
+
gem install ruby_spriter-0.6.7.gem
|
|
138
206
|
```
|
|
139
207
|
|
|
140
208
|
**Best for**: Contributors, developers wanting latest code
|
|
@@ -209,23 +277,79 @@ ruby_spriter --image sprite.png --remove-bg \
|
|
|
209
277
|
--threshold 1.5 --grow 2
|
|
210
278
|
```
|
|
211
279
|
|
|
280
|
+
### Batch Processing (v0.6.7+)
|
|
281
|
+
```bash
|
|
282
|
+
# Process all videos in a directory
|
|
283
|
+
ruby_spriter --batch --dir "videos/"
|
|
284
|
+
|
|
285
|
+
# Batch process with scaling and compression
|
|
286
|
+
ruby_spriter --batch --dir "videos/" --scale 50 --max-compress
|
|
287
|
+
|
|
288
|
+
# Batch process with output to different directory
|
|
289
|
+
ruby_spriter --batch --dir "videos/" --outputdir "output/"
|
|
290
|
+
|
|
291
|
+
# Batch process and consolidate all results
|
|
292
|
+
ruby_spriter --batch --dir "videos/" --batch-consolidate
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Consolidate Spritesheets
|
|
296
|
+
```bash
|
|
297
|
+
# Consolidate specific files (comma-separated)
|
|
298
|
+
ruby_spriter --consolidate file1.png,file2.png,file3.png
|
|
299
|
+
|
|
300
|
+
# Consolidate all spritesheets in a directory (v0.6.7+)
|
|
301
|
+
ruby_spriter --consolidate --dir "spritesheets/"
|
|
302
|
+
|
|
303
|
+
# Consolidate with compression
|
|
304
|
+
ruby_spriter --consolidate --dir "spritesheets/" --max-compress
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Frame Extraction (v0.6.8+)
|
|
308
|
+
```bash
|
|
309
|
+
# Extract specific frames by number
|
|
310
|
+
ruby_spriter --image sprite.png --extract 1,2,4,5,8 --columns 3
|
|
311
|
+
|
|
312
|
+
# Extract with duplicates for animation loops
|
|
313
|
+
ruby_spriter --image sprite.png --extract 1,1,2,2,3,3
|
|
314
|
+
|
|
315
|
+
# Extract, process, and save frames
|
|
316
|
+
ruby_spriter --image sprite.png --extract 1,3,5,7 \
|
|
317
|
+
--scale 50 --sharpen --save-frames
|
|
318
|
+
|
|
319
|
+
# Workflow: Add metadata then extract frames
|
|
320
|
+
ruby_spriter --image external.png --add-meta 4:4
|
|
321
|
+
ruby_spriter --image external.png --extract 1,5,9,13 --columns 2
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Metadata Management (v0.6.8+)
|
|
325
|
+
```bash
|
|
326
|
+
# Add metadata to external spritesheet
|
|
327
|
+
ruby_spriter --image sprite.png --add-meta 4:4
|
|
328
|
+
|
|
329
|
+
# Add metadata with partial grid (14 frames in 4x4 grid)
|
|
330
|
+
ruby_spriter --image sprite.png --add-meta 4:4 --frames 14
|
|
331
|
+
|
|
332
|
+
# Replace existing metadata
|
|
333
|
+
ruby_spriter --image existing.png --add-meta 8:8 --overwrite-meta
|
|
334
|
+
|
|
335
|
+
# Add metadata and copy to new file
|
|
336
|
+
ruby_spriter --image sprite.png --add-meta 4:4 --output sprite_meta.png
|
|
337
|
+
```
|
|
338
|
+
|
|
212
339
|
### Advanced Workflows
|
|
213
340
|
```bash
|
|
214
|
-
# Complete processing pipeline
|
|
341
|
+
# Complete processing pipeline with compression
|
|
215
342
|
ruby_spriter --video input.mp4 \
|
|
216
343
|
--frames 64 --columns 8 \
|
|
217
344
|
--scale 50 --interpolation nohalo \
|
|
218
345
|
--remove-bg \
|
|
219
|
-
--sharpen --sharpen-gain 0.8
|
|
346
|
+
--sharpen --sharpen-gain 0.8 \
|
|
347
|
+
--max-compress
|
|
220
348
|
|
|
221
349
|
# Process existing image with quality enhancement
|
|
222
350
|
ruby_spriter --image large_sprite.png \
|
|
223
351
|
--scale 50 --interpolation lohalo \
|
|
224
352
|
--sharpen --sharpen-gain 1.2
|
|
225
|
-
|
|
226
|
-
# Consolidate multiple spritesheets
|
|
227
|
-
ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
228
|
-
--output combined.png
|
|
229
353
|
```
|
|
230
354
|
|
|
231
355
|
---
|
|
@@ -238,7 +362,9 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
|
238
362
|
```bash
|
|
239
363
|
-v, --video FILE Input video file (MP4 only)
|
|
240
364
|
-i, --image FILE Input image file (PNG only)
|
|
241
|
-
--
|
|
365
|
+
--batch Batch process mode (use with --dir)
|
|
366
|
+
--dir DIRECTORY Directory for batch or consolidate operations
|
|
367
|
+
--consolidate [FILES] Consolidate spritesheets (comma-separated files or use with --dir)
|
|
242
368
|
--verify FILE Verify spritesheet metadata (PNG only)
|
|
243
369
|
```
|
|
244
370
|
|
|
@@ -284,8 +410,37 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
|
284
410
|
--preset contact 8ร? grid, 64 frames, 160px wide
|
|
285
411
|
```
|
|
286
412
|
|
|
413
|
+
#### **Batch Processing Options (v0.6.7+)**
|
|
414
|
+
```bash
|
|
415
|
+
--batch Enable batch processing mode
|
|
416
|
+
--dir DIRECTORY Directory containing MP4 files to process
|
|
417
|
+
--outputdir DIRECTORY Output directory for processed files
|
|
418
|
+
--batch-consolidate Consolidate all resulting spritesheets
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### **Compression Options (v0.6.7+)**
|
|
422
|
+
```bash
|
|
423
|
+
--max-compress Apply maximum PNG compression (preserves metadata)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
#### **Frame Extraction Options (v0.6.8+)**
|
|
427
|
+
```bash
|
|
428
|
+
--extract FRAMES Extract specific frames by number (e.g., 1,2,4,5,8)
|
|
429
|
+
--columns NUM Output grid columns for extracted spritesheet (default: 4)
|
|
430
|
+
--save-frames Keep individual extracted frames on disk
|
|
431
|
+
--split R:C Split spritesheet into all individual frames (rows:columns)
|
|
432
|
+
--override-md Override embedded metadata when using --split
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
#### **Metadata Management Options (v0.6.8+)**
|
|
436
|
+
```bash
|
|
437
|
+
--add-meta R:C Add spritesheet metadata (rows:columns, e.g., 4:4)
|
|
438
|
+
--overwrite-meta Replace existing metadata
|
|
439
|
+
```
|
|
440
|
+
|
|
287
441
|
#### **Other Options**
|
|
288
442
|
```bash
|
|
443
|
+
--overwrite Overwrite existing output files (default: create unique filenames)
|
|
289
444
|
--keep-temp Keep temporary files for debugging
|
|
290
445
|
--debug Enable verbose output + keep temp files
|
|
291
446
|
--check-dependencies Check if all required external tools are installed
|
|
@@ -320,11 +475,28 @@ ruby_spriter --video explosion.mp4 \
|
|
|
320
475
|
|
|
321
476
|
#### Multiple Character Directions
|
|
322
477
|
```bash
|
|
323
|
-
# Consolidate walk cycles for 8 directions
|
|
478
|
+
# Consolidate walk cycles for 8 directions (file list)
|
|
324
479
|
ruby_spriter --consolidate \
|
|
325
480
|
walk_n.png,walk_ne.png,walk_e.png,walk_se.png,\
|
|
326
481
|
walk_s.png,walk_sw.png,walk_w.png,walk_nw.png \
|
|
327
482
|
--output character_walk_all.png
|
|
483
|
+
|
|
484
|
+
# Or consolidate all spritesheets in a directory (v0.6.7+)
|
|
485
|
+
ruby_spriter --consolidate --dir "walk_cycles/" \
|
|
486
|
+
--output character_walk_all.png
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Batch Processing Workflows (v0.6.7+)
|
|
490
|
+
```bash
|
|
491
|
+
# Process entire animation library
|
|
492
|
+
ruby_spriter --batch --dir "raw_animations/" \
|
|
493
|
+
--outputdir "game_assets/sprites/" \
|
|
494
|
+
--scale 50 --remove-bg --sharpen --max-compress
|
|
495
|
+
|
|
496
|
+
# Create and consolidate multiple character states
|
|
497
|
+
ruby_spriter --batch --dir "character_states/" \
|
|
498
|
+
--frames 8 --columns 4 \
|
|
499
|
+
--batch-consolidate
|
|
328
500
|
```
|
|
329
501
|
|
|
330
502
|
### Quality Enhancement
|
|
@@ -333,6 +505,7 @@ ruby_spriter --consolidate \
|
|
|
333
505
|
ruby_spriter --image 4k_sprite.png \
|
|
334
506
|
--scale 25 --interpolation lohalo \
|
|
335
507
|
--sharpen --sharpen-gain 1.0 \
|
|
508
|
+
--max-compress \
|
|
336
509
|
--output hd_sprite.png
|
|
337
510
|
```
|
|
338
511
|
|
|
@@ -340,6 +513,127 @@ ruby_spriter --image 4k_sprite.png \
|
|
|
340
513
|
|
|
341
514
|
## ๐ง Advanced Features
|
|
342
515
|
|
|
516
|
+
### Batch Processing (v0.6.7+)
|
|
517
|
+
|
|
518
|
+
Process entire directories of MP4 files with consistent settings:
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
# Basic batch processing
|
|
522
|
+
ruby_spriter --batch --dir "animations/"
|
|
523
|
+
# Processes all MP4s with default 4x4 grid
|
|
524
|
+
|
|
525
|
+
# Batch with processing options
|
|
526
|
+
ruby_spriter --batch --dir "animations/" \
|
|
527
|
+
--frames 32 --columns 8 \
|
|
528
|
+
--scale 50 --remove-bg --sharpen \
|
|
529
|
+
--max-compress
|
|
530
|
+
|
|
531
|
+
# Batch with output directory
|
|
532
|
+
ruby_spriter --batch --dir "raw_videos/" \
|
|
533
|
+
--outputdir "game_assets/sprites/"
|
|
534
|
+
|
|
535
|
+
# Batch and consolidate results
|
|
536
|
+
ruby_spriter --batch --dir "character_states/" \
|
|
537
|
+
--batch-consolidate \
|
|
538
|
+
--output character_complete.png
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
**Features:**
|
|
542
|
+
- Automatically finds all MP4 files in directory
|
|
543
|
+
- Applies consistent processing to all videos
|
|
544
|
+
- Enforces unique output filenames (unless `--overwrite`)
|
|
545
|
+
- Continues processing if one file fails
|
|
546
|
+
- Optional consolidation of all results
|
|
547
|
+
- Supports all video and image processing options
|
|
548
|
+
|
|
549
|
+
### Maximum Compression (v0.6.7+)
|
|
550
|
+
|
|
551
|
+
Reduce file sizes while preserving metadata:
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
# Compress during video processing
|
|
555
|
+
ruby_spriter --video input.mp4 --max-compress
|
|
556
|
+
|
|
557
|
+
# Compress during image processing
|
|
558
|
+
ruby_spriter --image sprite.png --scale 50 --max-compress
|
|
559
|
+
|
|
560
|
+
# Compress batch output
|
|
561
|
+
ruby_spriter --batch --dir "videos/" --max-compress
|
|
562
|
+
|
|
563
|
+
# Compress consolidated output
|
|
564
|
+
ruby_spriter --consolidate --dir "sprites/" --max-compress
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
**Compression Details:**
|
|
568
|
+
- Uses ImageMagick optimal PNG compression settings
|
|
569
|
+
- Compression level 9 (maximum zlib)
|
|
570
|
+
- Paeth filter (compression filter 5)
|
|
571
|
+
- Filtered strategy (compression strategy 1)
|
|
572
|
+
- Quality 95
|
|
573
|
+
- Preserves embedded spritesheet metadata
|
|
574
|
+
- Displays size reduction statistics
|
|
575
|
+
|
|
576
|
+
### Directory-Based Consolidation (v0.6.7+)
|
|
577
|
+
|
|
578
|
+
Consolidate all spritesheets in a directory automatically:
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
# Scan directory and consolidate all spritesheets
|
|
582
|
+
ruby_spriter --consolidate --dir "character_animations/"
|
|
583
|
+
|
|
584
|
+
# With output directory
|
|
585
|
+
ruby_spriter --consolidate --dir "sprites/" \
|
|
586
|
+
--outputdir "final_assets/"
|
|
587
|
+
|
|
588
|
+
# With compression
|
|
589
|
+
ruby_spriter --consolidate --dir "sprites/" \
|
|
590
|
+
--max-compress \
|
|
591
|
+
--output character_complete.png
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
**Directory Mode Features:**
|
|
595
|
+
- Automatically scans for PNG files with metadata
|
|
596
|
+
- Filters out non-spritesheet images
|
|
597
|
+
- Sorts files alphabetically before consolidation
|
|
598
|
+
- Requires at least 2 valid spritesheets
|
|
599
|
+
- Cannot mix with comma-separated file list mode
|
|
600
|
+
|
|
601
|
+
### File Protection with Unique Filenames (v0.6.6+)
|
|
602
|
+
|
|
603
|
+
By default, Ruby Spriter protects your existing files by generating unique timestamped filenames when output files already exist:
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
# First run - creates new file
|
|
607
|
+
ruby_spriter --image sprite.png --remove-bg
|
|
608
|
+
# Output: sprite-nobg-fuzzy.png
|
|
609
|
+
|
|
610
|
+
# Second run - creates unique file instead of overwriting
|
|
611
|
+
ruby_spriter --image sprite.png --remove-bg
|
|
612
|
+
# Output: sprite-nobg-fuzzy_20251023_170542_123.png
|
|
613
|
+
|
|
614
|
+
# Third run - another unique file
|
|
615
|
+
ruby_spriter --image sprite.png --remove-bg
|
|
616
|
+
# Output: sprite-nobg-fuzzy_20251023_170545_456.png
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
#### Overwrite Mode
|
|
620
|
+
|
|
621
|
+
Use `--overwrite` to replace existing files instead:
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
# Always overwrites sprite-nobg-fuzzy.png
|
|
625
|
+
ruby_spriter --image sprite.png --remove-bg --overwrite
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### Behavior by Mode
|
|
629
|
+
|
|
630
|
+
| Mode | Default Filename | Unique on Collision |
|
|
631
|
+
|------|------------------|---------------------|
|
|
632
|
+
| `--video` | `input_spritesheet.png` | โ
Yes |
|
|
633
|
+
| `--image` (with processing) | `input-scaled-50pct.png` | โ
Yes |
|
|
634
|
+
| `--consolidate` | `consolidated_spritesheet.png` | โ
Yes |
|
|
635
|
+
| Any with `--output` | Your specified name | โ
Yes (unless `--overwrite`) |
|
|
636
|
+
|
|
343
637
|
### Metadata Management
|
|
344
638
|
|
|
345
639
|
Ruby Spriter embeds grid information directly into PNG files:
|
|
@@ -395,12 +689,13 @@ ruby_spriter --video input.mp4 --scale 50 --sharpen --debug
|
|
|
395
689
|
|
|
396
690
|
## ๐๏ธ Architecture
|
|
397
691
|
|
|
398
|
-
###
|
|
692
|
+
### Five Processing Modes
|
|
399
693
|
|
|
400
694
|
1. **Video Mode** - MP4 โ Spritesheet โ Optional Processing
|
|
401
695
|
2. **Image Mode** - PNG โ Processing โ Enhanced PNG
|
|
402
|
-
3. **Consolidate Mode** - Multiple PNGs โ Combined Spritesheet
|
|
403
|
-
4. **
|
|
696
|
+
3. **Consolidate Mode** - Multiple PNGs โ Combined Spritesheet (file list or directory)
|
|
697
|
+
4. **Batch Mode** (v0.6.7+) - Directory of MP4s โ Multiple Spritesheets โ Optional Consolidation
|
|
698
|
+
5. **Verify Mode** - Read and display embedded metadata
|
|
404
699
|
|
|
405
700
|
### Processing Pipeline
|
|
406
701
|
|
|
@@ -434,7 +729,9 @@ Output PNG with Metadata
|
|
|
434
729
|
|
|
435
730
|
**Consolidate Mode:**
|
|
436
731
|
```
|
|
437
|
-
Multiple Input PNGs
|
|
732
|
+
Multiple Input PNGs (file list or directory scan)
|
|
733
|
+
โ
|
|
734
|
+
[Metadata Filter] Find PNGs with spritesheet metadata (directory mode)
|
|
438
735
|
โ
|
|
439
736
|
[ImageMagick] Read Metadata from Each
|
|
440
737
|
โ
|
|
@@ -444,15 +741,36 @@ Multiple Input PNGs
|
|
|
444
741
|
โ
|
|
445
742
|
[ImageMagick] Embed Combined Metadata
|
|
446
743
|
โ
|
|
744
|
+
[ImageMagick] Optional Max Compression
|
|
745
|
+
โ
|
|
447
746
|
Output Consolidated PNG
|
|
448
747
|
```
|
|
449
748
|
|
|
749
|
+
**Batch Mode (v0.6.7+):**
|
|
750
|
+
```
|
|
751
|
+
Directory of MP4 Files
|
|
752
|
+
โ
|
|
753
|
+
[Scan] Find all MP4 files
|
|
754
|
+
โ
|
|
755
|
+
[Loop] For each MP4:
|
|
756
|
+
โโ [FFmpeg] Extract frames + create spritesheet
|
|
757
|
+
โโ [GIMP] Optional scaling/background removal
|
|
758
|
+
โโ [ImageMagick] Optional sharpening
|
|
759
|
+
โโ [ImageMagick] Optional max compression
|
|
760
|
+
โ
|
|
761
|
+
[Optional] Consolidate all results with --batch-consolidate
|
|
762
|
+
โ
|
|
763
|
+
Multiple Output PNGs (or one consolidated PNG)
|
|
764
|
+
```
|
|
765
|
+
|
|
450
766
|
### Key Components
|
|
451
767
|
|
|
452
768
|
- **Processor** - Main orchestration
|
|
453
769
|
- **VideoProcessor** - FFmpeg integration
|
|
454
770
|
- **GimpProcessor** - GIMP batch scripting
|
|
455
|
-
- **Consolidator** - Multi-sheet merging
|
|
771
|
+
- **Consolidator** - Multi-sheet merging (file list or directory)
|
|
772
|
+
- **BatchProcessor** (v0.6.7+) - Directory batch processing
|
|
773
|
+
- **CompressionManager** (v0.6.7+) - PNG compression with metadata preservation
|
|
456
774
|
- **MetadataManager** - PNG metadata handling
|
|
457
775
|
- **DependencyChecker** - Tool detection
|
|
458
776
|
- **Platform** - Cross-platform abstraction
|
|
@@ -493,12 +811,17 @@ ruby-spriter/
|
|
|
493
811
|
โ โโโ video_processor.rb
|
|
494
812
|
โ โโโ gimp_processor.rb
|
|
495
813
|
โ โโโ consolidator.rb
|
|
814
|
+
โ โโโ batch_processor.rb # v0.6.7+
|
|
815
|
+
โ โโโ compression_manager.rb # v0.6.7+
|
|
496
816
|
โ โโโ metadata_manager.rb
|
|
497
817
|
โ โโโ dependency_checker.rb
|
|
498
818
|
โ โโโ platform.rb
|
|
499
819
|
โ โโโ utils/ # Helper modules
|
|
500
|
-
โโโ spec/ # RSpec tests
|
|
820
|
+
โโโ spec/ # RSpec tests (313 examples)
|
|
821
|
+
โโโ .claude/
|
|
822
|
+
โ โโโ agents/ # Custom Claude Code agent config
|
|
501
823
|
โโโ CLAUDE.md # Developer documentation
|
|
824
|
+
โโโ CHANGELOG.md # Version history
|
|
502
825
|
โโโ README.md # This file
|
|
503
826
|
```
|
|
504
827
|
|
|
@@ -516,15 +839,33 @@ bundle exec ruby_spriter --video test.mp4
|
|
|
516
839
|
|
|
517
840
|
## ๐ค Contributing
|
|
518
841
|
|
|
519
|
-
Contributions are welcome!
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
842
|
+
Contributions are welcome! This project follows strict **Test-Driven Development (TDD)** practices.
|
|
843
|
+
|
|
844
|
+
### Development Workflow
|
|
845
|
+
|
|
846
|
+
1. **Fork the repository**
|
|
847
|
+
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
|
848
|
+
3. **Follow TDD Red-Green-Refactor cycle:**
|
|
849
|
+
- โ
**Red**: Write ONE test โ Run it โ Verify it FAILS
|
|
850
|
+
- โ
**Green**: Write minimal code โ Run test โ Verify it PASSES
|
|
851
|
+
- โ
**Refactor**: Clean up โ Run all tests โ Verify still passing
|
|
852
|
+
- โ
**Repeat** for each new test
|
|
853
|
+
4. **Ensure all tests pass** (`bundle exec rspec`)
|
|
854
|
+
5. **Update documentation** (README.md, CHANGELOG.md, CLAUDE.md)
|
|
855
|
+
6. **Commit your changes** (`git commit -m 'Add amazing feature'`)
|
|
856
|
+
7. **Push to the branch** (`git push origin feature/amazing-feature`)
|
|
857
|
+
8. **Open a Pull Request**
|
|
858
|
+
|
|
859
|
+
### Agent Configuration
|
|
860
|
+
|
|
861
|
+
This project includes a custom Claude Code agent (`.claude/agents/ruby-spriter-architect.md`) that enforces:
|
|
862
|
+
- Strict TDD (Red-Green-Refactor) workflow
|
|
863
|
+
- Architecture consistency
|
|
864
|
+
- Documentation maintenance
|
|
865
|
+
- Cross-platform compatibility
|
|
866
|
+
- Test coverage requirements
|
|
867
|
+
|
|
868
|
+
The agent configuration is version-controlled and shared across the team.
|
|
528
869
|
|
|
529
870
|
---
|
|
530
871
|
|