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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f794b569ca3be84a3e33923a645ee3f98a8771d12d1e9befc5bc9f63241d079d
4
- data.tar.gz: b8e2078fa01d7095ec071c83e6d0e17683f86b2653a8f610b50925084e9d4984
3
+ metadata.gz: 1cec402c211c4204134f1a9cf6974093c3e36fd46a45301282260454c91ff33d
4
+ data.tar.gz: 0de0714668911755bc80ac6f0841d4aa2034f03797dcf027ef6a61e495f46936
5
5
  SHA512:
6
- metadata.gz: 7fea2f1769c71ae55b040b41c6f1dd29f8d1c384eda0606464fee0c26892d48463586f541a484395c3368170484028488bc3bc6b7f1820f20132ec004fc5ae81
7
- data.tar.gz: a751cdce97247fc81627bb3a0d4628c5c560885ce4df8eed744c9923bdd8cb86842c07363e02cc66ff94f2792ff8a50504b980ba7035e559014e1bc24f692985
6
+ metadata.gz: 71bbe470ac06aaa1acadf00fba48b911daa6f803010a0e88145a46847078e2db3db25cdeb4462ada7a74e9711b7b36c4b706a36bbd9f04ff53af2087a1882434
7
+ data.tar.gz: f5f092588802ce4402fe952370f17ba76f59543cdd99b24e83f845e1ca2b2a5cc813481909180ac418d2f34f65dcb4ae5a828794e40abd3164a004ef6695235d
data/CHANGELOG.md CHANGED
@@ -12,6 +12,194 @@ 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
+
153
+ ## [0.6.6] - 2025-10-23
154
+
155
+ ### 🔒 File Protection & Frame Extraction Release
156
+
157
+ #### Added
158
+ - **Automatic Unique Filenames**: By default, generates timestamped filenames to prevent accidental overwrites
159
+ - Format: `filename_YYYYMMDD_HHMMSS_mmm.ext` (includes milliseconds)
160
+ - Applies to all output modes: `--video`, `--image`, `--consolidate`
161
+ - Works with both auto-generated and `--output` specified filenames
162
+ - **`--overwrite` Flag**: Optional flag to explicitly allow overwriting existing files
163
+ - **`--split R:C` Option**: Split spritesheets into individual frames for `--image` workflow
164
+ - Format: `--split 4:4` (rows:columns, e.g., 4 rows × 4 columns)
165
+ - Validation: Rows and columns must be 1-99, total frames < 1000
166
+ - Frame naming: `FRddd_filename.png` (3-digit zero-padded format: FR001, FR002, ..., FR999)
167
+ - Output directory: `filename_frames/`
168
+ - Metadata priority: Uses embedded metadata if available, unless `--override-md` flag is provided
169
+ - Dimension validation: Image dimensions must divide evenly by specified rows and columns
170
+ - **`--override-md` Flag**: Override embedded metadata when using `--split` with images that have metadata
171
+ - **Intermediate File Cleanup**: Fixed cleanup of intermediate files from GIMP processing
172
+ - Now correctly removes files with dash separator (e.g., `file-nobg-fuzzy.png`, `file-scaled-40pct.png`)
173
+ - Added Windows-compatible path normalization for file comparison
174
+ - **Frame Extraction Tests**: 17 new comprehensive tests for split functionality
175
+ - CLI option tests for `--split` and `--override-md`
176
+ - Format and range validation tests (10 tests)
177
+ - Metadata priority logic tests (5 tests)
178
+ - Updated SpritesheetSplitter tests for FR%03d format
179
+
180
+ #### Changed
181
+ - **Default Behavior**: Changed from overwriting to creating unique files (breaking change, but safer)
182
+ - **GimpProcessor**: Now respects `--overwrite` flag for scaled and background-removed images
183
+ - **Consolidate Workflow**: Default filename changed from `consolidated_spritesheet_TIMESTAMP.png` to `consolidated_spritesheet.png` (uniqueness handled by flag)
184
+ - **Frame Naming Format**: Changed from FR%02d (2 digits) to FR%03d (3 digits) to support up to 999 frames
185
+ - **Intermediate File Pattern**: Fixed glob pattern from underscore to dash separator for GIMP output files
186
+
187
+ #### Technical Details
188
+ - New utility methods in `Utils::FileHelper`:
189
+ - `unique_filename(path)` - Generates timestamped filename if file exists
190
+ - `ensure_unique_output(path, overwrite:)` - Applies overwrite logic
191
+ - New methods in `Processor`:
192
+ - `validate_split_option!` - Validates split format and ranges during initialization
193
+ - `determine_split_parameters(image_file)` - Implements metadata priority logic
194
+ - `validate_image_dimensions(image_file, rows, columns)` - Validates even division
195
+ - Processor workflows updated to use `ensure_unique_output` for all output paths
196
+ - `SpritesheetSplitter` updated to use 3-digit frame format (FR%03d)
197
+ - Test coverage increased to 72.27% (688/952 lines)
198
+
199
+ Closes #17, #19, #30
200
+
201
+ ---
202
+
15
203
  ## [0.6.5] - 2025-10-23
16
204
 
17
205
  ### 📦 Distribution & Packaging Release