ruby_spriter 0.6.6 โ 0.6.7.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/CHANGELOG.md +257 -0
- data/README.md +384 -33
- data/lib/ruby_spriter/batch_processor.rb +214 -0
- data/lib/ruby_spriter/cli.rb +355 -8
- data/lib/ruby_spriter/compression_manager.rb +101 -0
- data/lib/ruby_spriter/consolidator.rb +33 -0
- data/lib/ruby_spriter/dependency_checker.rb +65 -15
- data/lib/ruby_spriter/gimp_processor.rb +395 -4
- data/lib/ruby_spriter/platform.rb +56 -1
- data/lib/ruby_spriter/processor.rb +419 -9
- data/lib/ruby_spriter/version.rb +2 -2
- data/lib/ruby_spriter.rb +2 -0
- data/spec/ruby_spriter/batch_processor_spec.rb +200 -0
- data/spec/ruby_spriter/cli_spec.rb +387 -0
- data/spec/ruby_spriter/compression_manager_spec.rb +157 -0
- data/spec/ruby_spriter/consolidator_spec.rb +163 -0
- data/spec/ruby_spriter/platform_spec.rb +11 -1
- data/spec/ruby_spriter/processor_spec.rb +350 -0
- metadata +6 -2
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Ruby Spriter v0.6.
|
|
1
|
+
# Ruby Spriter v0.6.7.1
|
|
2
2
|
|
|
3
3
|
[](https://www.ruby-lang.org/)
|
|
4
4
|
[](LICENSE)
|
|
@@ -16,11 +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
|
|
21
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+)
|
|
22
26
|
- ๐ **Cross-Platform** - Works seamlessly on Windows, Linux, and macOS
|
|
23
|
-
- ๐งช **Production Ready** - Comprehensive RSpec test coverage
|
|
27
|
+
- ๐งช **Production Ready** - Comprehensive RSpec test coverage (365 tests)
|
|
24
28
|
|
|
25
29
|
### Image Processing Features
|
|
26
30
|
|
|
@@ -64,6 +68,7 @@ A powerful cross-platform Ruby tool for creating high-quality spritesheets from
|
|
|
64
68
|
| **FFprobe** | Latest | Video analysis (included with FFmpeg) |
|
|
65
69
|
| **ImageMagick** | 7.x+ | Metadata and sharpening |
|
|
66
70
|
| **GIMP** | 3.x (or 2.10) | Scaling and background removal |
|
|
71
|
+
| **Xvfb** | Latest (Linux only) | Virtual display for headless GIMP |
|
|
67
72
|
|
|
68
73
|
### Ruby Version
|
|
69
74
|
- Ruby 2.7.0 or higher
|
|
@@ -86,22 +91,104 @@ Ruby Spriter requires these external tools for video and image processing:
|
|
|
86
91
|
| **FFmpeg** | Video frame extraction | Any recent version |
|
|
87
92
|
| **ImageMagick** | Image manipulation & metadata | 7.x or 6.9+ |
|
|
88
93
|
| **GIMP** | Advanced image processing | 3.x (or 2.10) |
|
|
94
|
+
| **Xvfb** | Virtual display (Linux only) | Any recent version |
|
|
89
95
|
|
|
90
96
|
#### Installing Prerequisites
|
|
91
97
|
|
|
92
|
-
**Windows (Chocolatey)**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
**Windows (Chocolatey - Recommended)**
|
|
99
|
+
|
|
100
|
+
Chocolatey is a package manager for Windows that simplifies software installation. If you don't have Chocolatey installed:
|
|
101
|
+
|
|
102
|
+
1. **Install Chocolatey** (run PowerShell as Administrator):
|
|
103
|
+
```powershell
|
|
104
|
+
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'))
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Verify installation:
|
|
108
|
+
```powershell
|
|
109
|
+
choco --version
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. **Install Ruby** (if not already installed):
|
|
113
|
+
```powershell
|
|
114
|
+
choco install ruby -y
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Close and reopen PowerShell, then verify:
|
|
118
|
+
```powershell
|
|
119
|
+
ruby --version
|
|
120
|
+
gem --version
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
3. **Install Ruby Spriter dependencies**:
|
|
124
|
+
```powershell
|
|
125
|
+
choco install ffmpeg imagemagick gimp -y
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This installs all required tools:
|
|
129
|
+
- **FFmpeg** - Video processing
|
|
130
|
+
- **ImageMagick** - Image manipulation and metadata
|
|
131
|
+
- **GIMP** - Advanced image processing
|
|
132
|
+
|
|
133
|
+
4. **Restart your terminal** to ensure all tools are in your PATH
|
|
134
|
+
|
|
135
|
+
**Alternative: Manual Installation on Windows**
|
|
136
|
+
|
|
137
|
+
If you prefer not to use Chocolatey:
|
|
138
|
+
- **Ruby**: Download from [rubyinstaller.org](https://rubyinstaller.org/)
|
|
139
|
+
- **FFmpeg**: Download from [ffmpeg.org](https://ffmpeg.org/download.html)
|
|
140
|
+
- **ImageMagick**: Download from [imagemagick.org](https://imagemagick.org/script/download.php#windows)
|
|
141
|
+
- **GIMP**: Download from [gimp.org](https://www.gimp.org/downloads/)
|
|
96
142
|
|
|
97
143
|
**macOS (Homebrew)**
|
|
144
|
+
|
|
98
145
|
```bash
|
|
146
|
+
# Install Homebrew if not already installed
|
|
147
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
148
|
+
|
|
149
|
+
# Install Ruby (if not already installed)
|
|
150
|
+
brew install ruby
|
|
151
|
+
|
|
152
|
+
# Install Ruby Spriter dependencies
|
|
99
153
|
brew install ffmpeg imagemagick gimp
|
|
100
154
|
```
|
|
101
155
|
|
|
102
156
|
**Linux (Ubuntu/Debian)**
|
|
157
|
+
|
|
103
158
|
```bash
|
|
104
|
-
|
|
159
|
+
# Install Ruby (if not already installed)
|
|
160
|
+
sudo apt update && sudo apt install ruby-full -y
|
|
161
|
+
|
|
162
|
+
# Install Ruby Spriter dependencies
|
|
163
|
+
sudo apt install ffmpeg imagemagick -y
|
|
164
|
+
|
|
165
|
+
# Install GIMP 3.x via Flatpak (recommended)
|
|
166
|
+
sudo apt install flatpak -y
|
|
167
|
+
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
168
|
+
flatpak install flathub org.gimp.GIMP -y
|
|
169
|
+
|
|
170
|
+
# Install Xvfb for headless GIMP operation
|
|
171
|
+
sudo apt install xvfb -y
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Note for Linux Users**: GIMP 3.x requires a display connection. Ruby Spriter automatically uses Xvfb (X Virtual Framebuffer) with Flatpak socket isolation to provide a completely headless virtual display. No GIMP GUI windows will appear on your screen - perfect for both desktop use (no distractions) and server environments (CI/CD, Docker, SSH sessions).
|
|
175
|
+
|
|
176
|
+
**Linux (Fedora/RHEL)**
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Install Ruby (if not already installed)
|
|
180
|
+
sudo dnf install ruby -y
|
|
181
|
+
|
|
182
|
+
# Install Ruby Spriter dependencies
|
|
183
|
+
sudo dnf install ffmpeg imagemagick -y
|
|
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
|
|
105
192
|
```
|
|
106
193
|
|
|
107
194
|
---
|
|
@@ -135,7 +222,7 @@ bundle install
|
|
|
135
222
|
|
|
136
223
|
# Build and install gem locally
|
|
137
224
|
gem build ruby_spriter.gemspec
|
|
138
|
-
gem install ruby_spriter-0.6.
|
|
225
|
+
gem install ruby_spriter-0.6.7.gem
|
|
139
226
|
```
|
|
140
227
|
|
|
141
228
|
**Best for**: Contributors, developers wanting latest code
|
|
@@ -210,23 +297,79 @@ ruby_spriter --image sprite.png --remove-bg \
|
|
|
210
297
|
--threshold 1.5 --grow 2
|
|
211
298
|
```
|
|
212
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
|
+
|
|
213
359
|
### Advanced Workflows
|
|
214
360
|
```bash
|
|
215
|
-
# Complete processing pipeline
|
|
361
|
+
# Complete processing pipeline with compression
|
|
216
362
|
ruby_spriter --video input.mp4 \
|
|
217
363
|
--frames 64 --columns 8 \
|
|
218
364
|
--scale 50 --interpolation nohalo \
|
|
219
365
|
--remove-bg \
|
|
220
|
-
--sharpen --sharpen-gain 0.8
|
|
366
|
+
--sharpen --sharpen-gain 0.8 \
|
|
367
|
+
--max-compress
|
|
221
368
|
|
|
222
369
|
# Process existing image with quality enhancement
|
|
223
370
|
ruby_spriter --image large_sprite.png \
|
|
224
371
|
--scale 50 --interpolation lohalo \
|
|
225
372
|
--sharpen --sharpen-gain 1.2
|
|
226
|
-
|
|
227
|
-
# Consolidate multiple spritesheets
|
|
228
|
-
ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
229
|
-
--output combined.png
|
|
230
373
|
```
|
|
231
374
|
|
|
232
375
|
---
|
|
@@ -239,7 +382,9 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
|
239
382
|
```bash
|
|
240
383
|
-v, --video FILE Input video file (MP4 only)
|
|
241
384
|
-i, --image FILE Input image file (PNG only)
|
|
242
|
-
--
|
|
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)
|
|
243
388
|
--verify FILE Verify spritesheet metadata (PNG only)
|
|
244
389
|
```
|
|
245
390
|
|
|
@@ -285,6 +430,34 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
|
|
|
285
430
|
--preset contact 8ร? grid, 64 frames, 160px wide
|
|
286
431
|
```
|
|
287
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
|
+
|
|
288
461
|
#### **Other Options**
|
|
289
462
|
```bash
|
|
290
463
|
--overwrite Overwrite existing output files (default: create unique filenames)
|
|
@@ -322,11 +495,28 @@ ruby_spriter --video explosion.mp4 \
|
|
|
322
495
|
|
|
323
496
|
#### Multiple Character Directions
|
|
324
497
|
```bash
|
|
325
|
-
# Consolidate walk cycles for 8 directions
|
|
498
|
+
# Consolidate walk cycles for 8 directions (file list)
|
|
326
499
|
ruby_spriter --consolidate \
|
|
327
500
|
walk_n.png,walk_ne.png,walk_e.png,walk_se.png,\
|
|
328
501
|
walk_s.png,walk_sw.png,walk_w.png,walk_nw.png \
|
|
329
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
|
|
330
520
|
```
|
|
331
521
|
|
|
332
522
|
### Quality Enhancement
|
|
@@ -335,6 +525,7 @@ ruby_spriter --consolidate \
|
|
|
335
525
|
ruby_spriter --image 4k_sprite.png \
|
|
336
526
|
--scale 25 --interpolation lohalo \
|
|
337
527
|
--sharpen --sharpen-gain 1.0 \
|
|
528
|
+
--max-compress \
|
|
338
529
|
--output hd_sprite.png
|
|
339
530
|
```
|
|
340
531
|
|
|
@@ -342,6 +533,91 @@ ruby_spriter --image 4k_sprite.png \
|
|
|
342
533
|
|
|
343
534
|
## ๐ง Advanced Features
|
|
344
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
|
+
|
|
345
621
|
### File Protection with Unique Filenames (v0.6.6+)
|
|
346
622
|
|
|
347
623
|
By default, Ruby Spriter protects your existing files by generating unique timestamped filenames when output files already exist:
|
|
@@ -429,16 +705,45 @@ ruby_spriter --video input.mp4 --scale 50 --sharpen --debug
|
|
|
429
705
|
# - Processing timestamps
|
|
430
706
|
```
|
|
431
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
|
+
|
|
432
736
|
---
|
|
433
737
|
|
|
434
738
|
## ๐๏ธ Architecture
|
|
435
739
|
|
|
436
|
-
###
|
|
740
|
+
### Five Processing Modes
|
|
437
741
|
|
|
438
742
|
1. **Video Mode** - MP4 โ Spritesheet โ Optional Processing
|
|
439
743
|
2. **Image Mode** - PNG โ Processing โ Enhanced PNG
|
|
440
|
-
3. **Consolidate Mode** - Multiple PNGs โ Combined Spritesheet
|
|
441
|
-
4. **
|
|
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
|
|
442
747
|
|
|
443
748
|
### Processing Pipeline
|
|
444
749
|
|
|
@@ -472,7 +777,9 @@ Output PNG with Metadata
|
|
|
472
777
|
|
|
473
778
|
**Consolidate Mode:**
|
|
474
779
|
```
|
|
475
|
-
Multiple Input PNGs
|
|
780
|
+
Multiple Input PNGs (file list or directory scan)
|
|
781
|
+
โ
|
|
782
|
+
[Metadata Filter] Find PNGs with spritesheet metadata (directory mode)
|
|
476
783
|
โ
|
|
477
784
|
[ImageMagick] Read Metadata from Each
|
|
478
785
|
โ
|
|
@@ -482,15 +789,36 @@ Multiple Input PNGs
|
|
|
482
789
|
โ
|
|
483
790
|
[ImageMagick] Embed Combined Metadata
|
|
484
791
|
โ
|
|
792
|
+
[ImageMagick] Optional Max Compression
|
|
793
|
+
โ
|
|
485
794
|
Output Consolidated PNG
|
|
486
795
|
```
|
|
487
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
|
+
|
|
488
814
|
### Key Components
|
|
489
815
|
|
|
490
816
|
- **Processor** - Main orchestration
|
|
491
817
|
- **VideoProcessor** - FFmpeg integration
|
|
492
818
|
- **GimpProcessor** - GIMP batch scripting
|
|
493
|
-
- **Consolidator** - Multi-sheet merging
|
|
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
|
|
494
822
|
- **MetadataManager** - PNG metadata handling
|
|
495
823
|
- **DependencyChecker** - Tool detection
|
|
496
824
|
- **Platform** - Cross-platform abstraction
|
|
@@ -531,12 +859,17 @@ ruby-spriter/
|
|
|
531
859
|
โ โโโ video_processor.rb
|
|
532
860
|
โ โโโ gimp_processor.rb
|
|
533
861
|
โ โโโ consolidator.rb
|
|
862
|
+
โ โโโ batch_processor.rb # v0.6.7+
|
|
863
|
+
โ โโโ compression_manager.rb # v0.6.7+
|
|
534
864
|
โ โโโ metadata_manager.rb
|
|
535
865
|
โ โโโ dependency_checker.rb
|
|
536
866
|
โ โโโ platform.rb
|
|
537
867
|
โ โโโ utils/ # Helper modules
|
|
538
|
-
โโโ spec/ # RSpec tests
|
|
868
|
+
โโโ spec/ # RSpec tests (313 examples)
|
|
869
|
+
โโโ .claude/
|
|
870
|
+
โ โโโ agents/ # Custom Claude Code agent config
|
|
539
871
|
โโโ CLAUDE.md # Developer documentation
|
|
872
|
+
โโโ CHANGELOG.md # Version history
|
|
540
873
|
โโโ README.md # This file
|
|
541
874
|
```
|
|
542
875
|
|
|
@@ -554,15 +887,33 @@ bundle exec ruby_spriter --video test.mp4
|
|
|
554
887
|
|
|
555
888
|
## ๐ค Contributing
|
|
556
889
|
|
|
557
|
-
Contributions are welcome!
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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.
|
|
566
917
|
|
|
567
918
|
---
|
|
568
919
|
|