ruby_spriter 0.6.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6e4b3befadf222f9fe4a13b50eb16a5a39124c45f5dad2769f7c4f9153aae4f
4
- data.tar.gz: 9f13e8d5da4c706a3d834f5a8d125ee46a1d7f04e5a643c90bda451bdb7f6e9c
3
+ metadata.gz: 1cec402c211c4204134f1a9cf6974093c3e36fd46a45301282260454c91ff33d
4
+ data.tar.gz: 0de0714668911755bc80ac6f0841d4aa2034f03797dcf027ef6a61e495f46936
5
5
  SHA512:
6
- metadata.gz: 8b05aec242fb65fb3f8745e276f7ec35ce2d05884f62e9b5af8fcef896a8f66ba2050c48d9c6e6c7400ad4ba93215225e5624c04bba25417e32dfff2e255b345
7
- data.tar.gz: 97631e37ef5cbe5bb544526d1e696a870dc9cb26759d2838b1af4f77d81e03696f717225f3858ac55bd2a2ecdd3e86dbe6a4e8c91dc4ac8c75f52f7ff1df68e3
6
+ metadata.gz: 71bbe470ac06aaa1acadf00fba48b911daa6f803010a0e88145a46847078e2db3db25cdeb4462ada7a74e9711b7b36c4b706a36bbd9f04ff53af2087a1882434
7
+ data.tar.gz: f5f092588802ce4402fe952370f17ba76f59543cdd99b24e83f845e1ca2b2a5cc813481909180ac418d2f34f65dcb4ae5a828794e40abd3164a004ef6695235d
data/CHANGELOG.md CHANGED
@@ -12,6 +12,144 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
 
13
13
  ---
14
14
 
15
+ ## [0.6.7] - 2025-10-24
16
+
17
+ ### 🚀 Batch Processing, Compression, Directory Consolidation & Frame Extraction Release
18
+
19
+ #### Added
20
+ - **Batch Processing Mode** (`--batch`): Process multiple MP4 files in a directory (Issue #16)
21
+ - `--dir DIRECTORY`: Specify directory containing MP4 files to process
22
+ - `--outputdir DIRECTORY`: Optional output directory (defaults to input directory)
23
+ - `--batch-consolidate`: Automatically consolidate all resulting spritesheets
24
+ - Supports all existing processing options: `--scale`, `--remove-bg`, `--sharpen`, `--interpolation`, etc.
25
+ - Enforces unique filenames unless `--overwrite` is specified
26
+ - Continues processing remaining videos if one fails
27
+ - Provides detailed summary of successes and failures
28
+ - **Maximum Compression** (`--max-compress`): Apply maximum PNG compression (Issue #14)
29
+ - Uses ImageMagick with optimal compression settings (level 9, filter 5, strategy 1, quality 95)
30
+ - Preserves embedded metadata through compression
31
+ - Works with all processing modes: `--video`, `--image`, `--batch`, `--consolidate`
32
+ - Displays compression statistics (original size, compressed size, savings, reduction percentage)
33
+ - **Directory-Based Consolidation**: `--consolidate` now supports `--dir` option to automatically consolidate all spritesheets in a directory
34
+ - Scans directory for PNG files with embedded spritesheet metadata
35
+ - Automatically filters out non-spritesheet PNG files
36
+ - Sorts files alphabetically by filename before consolidation
37
+ - Requires at least 2 valid spritesheets in directory
38
+ - Works with all existing consolidation options: `--output`, `--outputdir`, `--overwrite`, `--max-compress`, `--no-validate-columns`
39
+ - Mutual exclusivity validation: Cannot use both comma-separated file list and `--dir` with `--consolidate`
40
+ - **Enhanced Context-Sensitive Help System**: Mode-specific help displays only relevant options
41
+ - `ruby_spriter --video --help`: Shows video mode options (spritesheet generation, processing, output)
42
+ - `ruby_spriter --image --help`: Shows image mode options (processing, frame extraction, output)
43
+ - `ruby_spriter --consolidate --help`: Shows consolidation options (input methods, validation, output)
44
+ - `ruby_spriter --batch --help`: Shows batch processing options (directory processing, applied options)
45
+ - `ruby_spriter --split --help`: Shows frame extraction options (split format, metadata behavior, output)
46
+ - General `--help`: Shows mode-specific help hints and directs users to detailed help
47
+ - **Parent-Child Option Hierarchy**: Visual hierarchy (└─) shows modifier options grouped under parent options
48
+ - `--interpolation`, `--sharpen*` modifiers shown under `--scale`
49
+ - `--fuzzy`, `--threshold`, `--grow` modifiers shown under `--remove-bg`
50
+ - `--override-md` modifier shown under `--split`
51
+ - `--validate-columns` modifier shown under `--consolidate --dir`
52
+ - Organized by function (Image Processing, Output Options) instead of by tool (GIMP Processing Options)
53
+ - **Frame Extraction** (`--extract`): Extract specific frames and create new spritesheet
54
+ - `--extract FRAMES`: Comma-separated frame numbers (e.g., `1,2,4,5,8`)
55
+ - `--columns NUM`: Specify output grid columns (default: 4)
56
+ - Supports duplicate frame numbers for animation sequences
57
+ - 1-indexed frame numbering (left-to-right, top-to-bottom)
58
+ - Requires spritesheet metadata (works with `--verify` output)
59
+ - Works with all `--image` processing options: `--scale`, `--remove-bg`, `--sharpen`, `--max-compress`
60
+ - Automatic output naming with `_extracted` suffix or custom via `--output`
61
+ - Temporary frames deleted after reassembly unless `--save-frames` specified
62
+ - Minimum 2 frames required
63
+ - Out-of-bounds validation against spritesheet metadata
64
+ - Mutual exclusivity with `--split`
65
+ - **Metadata Management** (`--add-meta`): Add spritesheet metadata to images without metadata
66
+ - `--add-meta R:C`: Specify grid layout (rows:columns, e.g., `4:4`)
67
+ - `--overwrite-meta`: Replace existing metadata
68
+ - `--frames COUNT`: Custom frame count for partial grids (fewer frames than grid size)
69
+ - In-place modification by default (respects `--overwrite` flag)
70
+ - Optional `--output` for copying to new file
71
+ - Dimension validation: Image dimensions must divide evenly by grid
72
+ - Enables `--extract`, `--consolidate`, `--verify`, `--split` on external spritesheets
73
+ - Standalone mode: Cannot combine with `--scale`, `--remove-bg`, `--sharpen`
74
+ - **Enhanced `--save-frames`**: Now works with both `--video` and `--extract`
75
+ - **New Modules**:
76
+ - `BatchProcessor` (lib/ruby_spriter/batch_processor.rb): Orchestrates batch video processing
77
+ - `CompressionManager` (lib/ruby_spriter/compression_manager.rb): Handles PNG compression with metadata preservation
78
+ - **New Public Method**: `Consolidator#find_spritesheets_in_directory(directory)` for directory scanning
79
+ - **Comprehensive Test Coverage**: 68 new tests (13 for BatchProcessor, 11 for CompressionManager, 15 for directory consolidation, 7 for context-sensitive help, 22 for frame extraction and metadata management)
80
+
81
+ #### Changed
82
+ - **CLI**: Updated `--consolidate` description to mention `--dir` option
83
+ - **CLI**: Renamed "GIMP Processing Options" to "Processing Options" for tool-agnostic organization
84
+ - **CLI**: Updated image mode help with Frame Extraction & Reassembly section
85
+ - **CLI**: Added Metadata Management section to image mode help
86
+ - **Processor**: Refactored consolidation workflow to support both file list and directory modes
87
+ - **Test Suite**: Increased from 274 to 365 examples (all passing), 75.8% line coverage
88
+ - **CLI**: Added parent-child visual hierarchy to all context-sensitive help displays
89
+ - **CLI**: Corrected `--sharpen` to show as standalone option (not under `--scale`)
90
+
91
+ #### Examples
92
+ ```bash
93
+ # Get context-sensitive help for specific modes
94
+ ruby_spriter --video --help
95
+ ruby_spriter --image --help
96
+ ruby_spriter --consolidate --help
97
+ ruby_spriter --batch --help
98
+ ruby_spriter --split --help
99
+
100
+ # Process all videos in directory
101
+ ruby_spriter --batch --dir "videos/"
102
+
103
+ # Process with output to different directory
104
+ ruby_spriter --batch --dir "videos/" --outputdir "output/"
105
+
106
+ # Process and consolidate all results
107
+ ruby_spriter --batch --dir "videos/" --batch-consolidate
108
+
109
+ # Process with scaling and compression
110
+ ruby_spriter --batch --dir "videos/" --scale 50 --max-compress
111
+
112
+ # Compress video output
113
+ ruby_spriter --video "input.mp4" --max-compress
114
+
115
+ # Compress image processing output
116
+ ruby_spriter --image "sprite.png" --scale 50 --max-compress
117
+
118
+ # Directory-based consolidation
119
+ ruby_spriter --consolidate --dir "spritesheets/"
120
+ ruby_spriter --consolidate --dir "spritesheets/" --outputdir "output/"
121
+ ruby_spriter --consolidate --dir "spritesheets/" --max-compress
122
+
123
+ # File list consolidation still works
124
+ ruby_spriter --consolidate file1.png,file2.png,file3.png
125
+
126
+ # Extract specific frames and create new spritesheet
127
+ ruby_spriter --image sprite.png --extract 1,2,4,5,8 --columns 3
128
+
129
+ # Extract with duplicates for animation loops
130
+ ruby_spriter --image sprite.png --extract 1,1,2,2,3,3 --save-frames
131
+
132
+ # Extract and process
133
+ ruby_spriter --image sprite.png --extract 1,3,5,7 --scale 50 --sharpen
134
+
135
+ # Add metadata to external spritesheet
136
+ ruby_spriter --image sprite.png --add-meta 4:4
137
+
138
+ # Add metadata with partial grid
139
+ ruby_spriter --image sprite.png --add-meta 4:4 --frames 14 --output sprite_meta.png
140
+
141
+ # Replace existing metadata
142
+ ruby_spriter --image existing.png --add-meta 8:8 --overwrite-meta
143
+
144
+ # Workflow: Add metadata, then extract frames
145
+ ruby_spriter --image external.png --add-meta 4:4
146
+ ruby_spriter --image external.png --extract 1,5,9,13 --columns 2
147
+ ```
148
+
149
+ Closes #14, #16
150
+
151
+ ---
152
+
15
153
  ## [0.6.6] - 2025-10-23
16
154
 
17
155
  ### 🔒 File Protection & Frame Extraction Release
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ruby Spriter v0.6.6
1
+ # Ruby Spriter v0.6.7
2
2
 
3
3
  [![Ruby](https://img.shields.io/badge/Ruby-2.7+-red.svg)](https://www.ruby-lang.org/)
4
4
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](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 verify grid information in PNG files
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
 
@@ -89,19 +93,82 @@ Ruby Spriter requires these external tools for video and image processing:
89
93
 
90
94
  #### Installing Prerequisites
91
95
 
92
- **Windows (Chocolatey)**
93
- ```powershell
94
- choco install ffmpeg imagemagick gimp -y
95
- ```
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/)
96
140
 
97
141
  **macOS (Homebrew)**
142
+
98
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
99
151
  brew install ffmpeg imagemagick gimp
100
152
  ```
101
153
 
102
154
  **Linux (Ubuntu/Debian)**
155
+
156
+ ```bash
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
+
103
166
  ```bash
104
- sudo apt update && sudo apt install ffmpeg imagemagick gimp -y
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
105
172
  ```
106
173
 
107
174
  ---
@@ -135,7 +202,7 @@ bundle install
135
202
 
136
203
  # Build and install gem locally
137
204
  gem build ruby_spriter.gemspec
138
- gem install ruby_spriter-0.6.6.gem
205
+ gem install ruby_spriter-0.6.7.gem
139
206
  ```
140
207
 
141
208
  **Best for**: Contributors, developers wanting latest code
@@ -210,23 +277,79 @@ ruby_spriter --image sprite.png --remove-bg \
210
277
  --threshold 1.5 --grow 2
211
278
  ```
212
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
+
213
339
  ### Advanced Workflows
214
340
  ```bash
215
- # Complete processing pipeline
341
+ # Complete processing pipeline with compression
216
342
  ruby_spriter --video input.mp4 \
217
343
  --frames 64 --columns 8 \
218
344
  --scale 50 --interpolation nohalo \
219
345
  --remove-bg \
220
- --sharpen --sharpen-gain 0.8
346
+ --sharpen --sharpen-gain 0.8 \
347
+ --max-compress
221
348
 
222
349
  # Process existing image with quality enhancement
223
350
  ruby_spriter --image large_sprite.png \
224
351
  --scale 50 --interpolation lohalo \
225
352
  --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
353
  ```
231
354
 
232
355
  ---
@@ -239,7 +362,9 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
239
362
  ```bash
240
363
  -v, --video FILE Input video file (MP4 only)
241
364
  -i, --image FILE Input image file (PNG only)
242
- --consolidate FILES Consolidate multiple spritesheets (PNG only, comma-separated)
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)
243
368
  --verify FILE Verify spritesheet metadata (PNG only)
244
369
  ```
245
370
 
@@ -285,6 +410,34 @@ ruby_spriter --consolidate file1.png,file2.png,file3.png \
285
410
  --preset contact 8×? grid, 64 frames, 160px wide
286
411
  ```
287
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
+
288
441
  #### **Other Options**
289
442
  ```bash
290
443
  --overwrite Overwrite existing output files (default: create unique filenames)
@@ -322,11 +475,28 @@ ruby_spriter --video explosion.mp4 \
322
475
 
323
476
  #### Multiple Character Directions
324
477
  ```bash
325
- # Consolidate walk cycles for 8 directions
478
+ # Consolidate walk cycles for 8 directions (file list)
326
479
  ruby_spriter --consolidate \
327
480
  walk_n.png,walk_ne.png,walk_e.png,walk_se.png,\
328
481
  walk_s.png,walk_sw.png,walk_w.png,walk_nw.png \
329
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
330
500
  ```
331
501
 
332
502
  ### Quality Enhancement
@@ -335,6 +505,7 @@ ruby_spriter --consolidate \
335
505
  ruby_spriter --image 4k_sprite.png \
336
506
  --scale 25 --interpolation lohalo \
337
507
  --sharpen --sharpen-gain 1.0 \
508
+ --max-compress \
338
509
  --output hd_sprite.png
339
510
  ```
340
511
 
@@ -342,6 +513,91 @@ ruby_spriter --image 4k_sprite.png \
342
513
 
343
514
  ## 🔧 Advanced Features
344
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
+
345
601
  ### File Protection with Unique Filenames (v0.6.6+)
346
602
 
347
603
  By default, Ruby Spriter protects your existing files by generating unique timestamped filenames when output files already exist:
@@ -433,12 +689,13 @@ ruby_spriter --video input.mp4 --scale 50 --sharpen --debug
433
689
 
434
690
  ## 🏗️ Architecture
435
691
 
436
- ### Four Processing Modes
692
+ ### Five Processing Modes
437
693
 
438
694
  1. **Video Mode** - MP4 → Spritesheet → Optional Processing
439
695
  2. **Image Mode** - PNG → Processing → Enhanced PNG
440
- 3. **Consolidate Mode** - Multiple PNGs → Combined Spritesheet
441
- 4. **Verify Mode** - Read and display embedded metadata
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
442
699
 
443
700
  ### Processing Pipeline
444
701
 
@@ -472,7 +729,9 @@ Output PNG with Metadata
472
729
 
473
730
  **Consolidate Mode:**
474
731
  ```
475
- Multiple Input PNGs
732
+ Multiple Input PNGs (file list or directory scan)
733
+
734
+ [Metadata Filter] Find PNGs with spritesheet metadata (directory mode)
476
735
 
477
736
  [ImageMagick] Read Metadata from Each
478
737
 
@@ -482,15 +741,36 @@ Multiple Input PNGs
482
741
 
483
742
  [ImageMagick] Embed Combined Metadata
484
743
 
744
+ [ImageMagick] Optional Max Compression
745
+
485
746
  Output Consolidated PNG
486
747
  ```
487
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
+
488
766
  ### Key Components
489
767
 
490
768
  - **Processor** - Main orchestration
491
769
  - **VideoProcessor** - FFmpeg integration
492
770
  - **GimpProcessor** - GIMP batch scripting
493
- - **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
494
774
  - **MetadataManager** - PNG metadata handling
495
775
  - **DependencyChecker** - Tool detection
496
776
  - **Platform** - Cross-platform abstraction
@@ -531,12 +811,17 @@ ruby-spriter/
531
811
  │ ├── video_processor.rb
532
812
  │ ├── gimp_processor.rb
533
813
  │ ├── consolidator.rb
814
+ │ ├── batch_processor.rb # v0.6.7+
815
+ │ ├── compression_manager.rb # v0.6.7+
534
816
  │ ├── metadata_manager.rb
535
817
  │ ├── dependency_checker.rb
536
818
  │ ├── platform.rb
537
819
  │ └── utils/ # Helper modules
538
- ├── spec/ # RSpec tests
820
+ ├── spec/ # RSpec tests (313 examples)
821
+ ├── .claude/
822
+ │ └── agents/ # Custom Claude Code agent config
539
823
  ├── CLAUDE.md # Developer documentation
824
+ ├── CHANGELOG.md # Version history
540
825
  └── README.md # This file
541
826
  ```
542
827
 
@@ -554,15 +839,33 @@ bundle exec ruby_spriter --video test.mp4
554
839
 
555
840
  ## 🤝 Contributing
556
841
 
557
- Contributions are welcome! Please:
558
-
559
- 1. Fork the repository
560
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
561
- 3. Write tests for your changes
562
- 4. Ensure all tests pass (`bundle exec rspec`)
563
- 5. Commit your changes (`git commit -m 'Add amazing feature'`)
564
- 6. Push to the branch (`git push origin feature/amazing-feature`)
565
- 7. Open a Pull Request
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.
566
869
 
567
870
  ---
568
871