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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b62fa9c591b35279199986edc2cf288249c74d80d3479eba177293c53b1dca1
|
|
4
|
+
data.tar.gz: 71603609b398ec1ac7d0caac7c7194ef0d5e09170a4841e6e3f2f2c0cec65ff7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 634d8516173fcb9461af2b457003e7661728e0dfbc7ac72904b0d771831e5bb730ccba867fd03fdae86acbde1e525300ad88a367c29c118b5dbb6002332a2e9f
|
|
7
|
+
data.tar.gz: 5330230b6690fd1aaed69f62bd31e901bb5119ed8fa0a2c07a8e3a6b164b190c230809688d5b5142a254bc231a0fd9ac556ed2a97230f807f061c5be5ba4175c
|
data/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,263 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## [0.6.7.1] - 2025-10-24
|
|
16
|
+
|
|
17
|
+
### 🐧 Linux Support Enhancement Release
|
|
18
|
+
|
|
19
|
+
#### Added
|
|
20
|
+
- **Linux GIMP 3.x Support**: Full support for GIMP 3.x on Linux via Flatpak
|
|
21
|
+
- Automatic detection of Flatpak GIMP installation (`flatpak:org.gimp.GIMP`)
|
|
22
|
+
- Automatic Xvfb integration for completely headless GIMP operation
|
|
23
|
+
- Virtual display provided by Xvfb eliminates display connection requirement
|
|
24
|
+
- Flatpak socket isolation (`--nosocket=x11 --nosocket=wayland`) prevents GUI from appearing
|
|
25
|
+
- Python-fu batch mode works correctly with `python-fu-eval` interpreter
|
|
26
|
+
- Background removal, scaling, and all GIMP features fully functional
|
|
27
|
+
- Perfect for desktop use (no GUI distraction) and server environments (CI/CD, Docker, SSH)
|
|
28
|
+
- **GIMP Version Detection**: Detect and report GIMP version (2.x or 3.x)
|
|
29
|
+
- `Platform.detect_gimp_version(version_output)` - Parse version from `--version` output
|
|
30
|
+
- `Platform.get_gimp_version(gimp_path)` - Get version from executable or Flatpak
|
|
31
|
+
- Works with both regular executables and Flatpak installations
|
|
32
|
+
- **Xvfb Dependency Checking**: Added Xvfb to dependency checker (Linux only)
|
|
33
|
+
- Marked as required on Linux, optional on Windows/macOS
|
|
34
|
+
- Provides clear installation instructions if missing
|
|
35
|
+
- Validates availability before GIMP operations
|
|
36
|
+
- **DependencyChecker Version Tracking**: Store and report detected GIMP version
|
|
37
|
+
- **Xvfb Integration**: Transparent Xvfb usage when GIMP Flatpak detected
|
|
38
|
+
- Command format: `xvfb-run --auto-servernum --server-args='-screen 0 1024x768x24' flatpak run --nosocket=x11 --nosocket=wayland org.gimp.GIMP --no-splash --quit --batch-interpreter=python-fu-eval`
|
|
39
|
+
- No user configuration required - works automatically
|
|
40
|
+
- Completely headless - no GUI windows appear on screen
|
|
41
|
+
|
|
42
|
+
#### Changed
|
|
43
|
+
- **Platform Detection**: Enhanced to detect Flatpak GIMP alongside traditional installations
|
|
44
|
+
- **GimpProcessor**: Updated to support both GIMP 2.x and 3.x APIs (version-aware)
|
|
45
|
+
- **Unix GIMP Execution**: Automatically uses Xvfb with socket isolation for Flatpak installations
|
|
46
|
+
- **Alternative GIMP Paths**: Added `flatpak:org.gimp.GIMP` to Linux search paths
|
|
47
|
+
- **Warning Filters**: Enhanced to filter Xvfb, Wayland, and Flatpak cosmetic warnings
|
|
48
|
+
- **DependencyChecker**: Now supports platform-specific optional dependencies
|
|
49
|
+
|
|
50
|
+
#### Technical Details
|
|
51
|
+
- **GIMP Flatpak Detection**: Uses `flatpak list --app | grep` to verify installation
|
|
52
|
+
- **Version Parsing**: Regex-based parsing of `GIMP version X.Y.Z` output
|
|
53
|
+
- **Python Interpreter**: Correct name is `python-fu-eval` (not `python-eval`)
|
|
54
|
+
- **Xvfb Flags**:
|
|
55
|
+
- `--auto-servernum` - Automatically finds free display number
|
|
56
|
+
- `--server-args='-screen 0 1024x768x24'` - Configures virtual display
|
|
57
|
+
- **Flatpak Socket Isolation**:
|
|
58
|
+
- `--nosocket=x11` - Prevents access to host X11 display socket
|
|
59
|
+
- `--nosocket=wayland` - Prevents access to host Wayland display socket
|
|
60
|
+
- Ensures GIMP runs only in Xvfb virtual display
|
|
61
|
+
- **Platform Module**: New methods for version detection and Flatpak handling
|
|
62
|
+
- **Warning Filtering**: Filters Gdk-WARNING, LibGimp-WARNING, Gimp-Core-WARNING, X11 socket messages
|
|
63
|
+
|
|
64
|
+
#### Installation Requirements (Linux)
|
|
65
|
+
```bash
|
|
66
|
+
# Ubuntu/Debian
|
|
67
|
+
sudo apt install flatpak xvfb -y
|
|
68
|
+
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
69
|
+
flatpak install flathub org.gimp.GIMP -y
|
|
70
|
+
|
|
71
|
+
# Fedora/RHEL
|
|
72
|
+
sudo dnf install flatpak xorg-x11-server-Xvfb -y
|
|
73
|
+
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
74
|
+
flatpak install flathub org.gimp.GIMP -y
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Example Output
|
|
78
|
+
```bash
|
|
79
|
+
$ ruby_spriter --check-dependencies
|
|
80
|
+
============================================================
|
|
81
|
+
Dependency Check
|
|
82
|
+
============================================================
|
|
83
|
+
|
|
84
|
+
✅ FFMPEG
|
|
85
|
+
Found: 6.1.1
|
|
86
|
+
|
|
87
|
+
✅ FFPROBE
|
|
88
|
+
Found: 6.1.1
|
|
89
|
+
|
|
90
|
+
✅ IMAGEMAGICK
|
|
91
|
+
Found: Version: ImageMagick 6.9.12-98 Q16 x86_64
|
|
92
|
+
|
|
93
|
+
✅ XVFB
|
|
94
|
+
Found: Usage: xvfb-run [OPTION ...] COMMAND
|
|
95
|
+
|
|
96
|
+
✅ GIMP
|
|
97
|
+
Found: flatpak:org.gimp.GIMP
|
|
98
|
+
Version: GIMP 3.0.6
|
|
99
|
+
|
|
100
|
+
============================================================
|
|
101
|
+
|
|
102
|
+
$ ruby_spriter --image sprite.png --remove-bg
|
|
103
|
+
============================================================
|
|
104
|
+
GIMP Processing
|
|
105
|
+
============================================================
|
|
106
|
+
📝 Using GIMP via Xvfb (virtual display)
|
|
107
|
+
Removing background (fuzzy select)...
|
|
108
|
+
=== GIMP Messages ===
|
|
109
|
+
Loading image...
|
|
110
|
+
Image size: 1280x748
|
|
111
|
+
Added alpha channel
|
|
112
|
+
Sampling 4 corners...
|
|
113
|
+
Using FUZZY SELECT (contiguous regions only)
|
|
114
|
+
Corner 1 at (0, 0)
|
|
115
|
+
Corner 2 at (1279, 0)
|
|
116
|
+
Corner 3 at (0, 747)
|
|
117
|
+
Corner 4 at (1279, 747)
|
|
118
|
+
Selection complete
|
|
119
|
+
Growing selection by 1 pixels...
|
|
120
|
+
Selection grown
|
|
121
|
+
Removing background...
|
|
122
|
+
Background removed
|
|
123
|
+
Deselecting...
|
|
124
|
+
Exporting...
|
|
125
|
+
SUCCESS - Background removed!
|
|
126
|
+
====================
|
|
127
|
+
✅ Background Removal complete (142.15 KB)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Note**: No GIMP GUI window appears on screen - completely headless operation!
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## [0.6.7] - 2025-10-24
|
|
135
|
+
|
|
136
|
+
### 🚀 Batch Processing, Compression, Directory Consolidation & Frame Extraction Release
|
|
137
|
+
|
|
138
|
+
#### Added
|
|
139
|
+
- **Batch Processing Mode** (`--batch`): Process multiple MP4 files in a directory (Issue #16)
|
|
140
|
+
- `--dir DIRECTORY`: Specify directory containing MP4 files to process
|
|
141
|
+
- `--outputdir DIRECTORY`: Optional output directory (defaults to input directory)
|
|
142
|
+
- `--batch-consolidate`: Automatically consolidate all resulting spritesheets
|
|
143
|
+
- Supports all existing processing options: `--scale`, `--remove-bg`, `--sharpen`, `--interpolation`, etc.
|
|
144
|
+
- Enforces unique filenames unless `--overwrite` is specified
|
|
145
|
+
- Continues processing remaining videos if one fails
|
|
146
|
+
- Provides detailed summary of successes and failures
|
|
147
|
+
- **Maximum Compression** (`--max-compress`): Apply maximum PNG compression (Issue #14)
|
|
148
|
+
- Uses ImageMagick with optimal compression settings (level 9, filter 5, strategy 1, quality 95)
|
|
149
|
+
- Preserves embedded metadata through compression
|
|
150
|
+
- Works with all processing modes: `--video`, `--image`, `--batch`, `--consolidate`
|
|
151
|
+
- Displays compression statistics (original size, compressed size, savings, reduction percentage)
|
|
152
|
+
- **Directory-Based Consolidation**: `--consolidate` now supports `--dir` option to automatically consolidate all spritesheets in a directory
|
|
153
|
+
- Scans directory for PNG files with embedded spritesheet metadata
|
|
154
|
+
- Automatically filters out non-spritesheet PNG files
|
|
155
|
+
- Sorts files alphabetically by filename before consolidation
|
|
156
|
+
- Requires at least 2 valid spritesheets in directory
|
|
157
|
+
- Works with all existing consolidation options: `--output`, `--outputdir`, `--overwrite`, `--max-compress`, `--no-validate-columns`
|
|
158
|
+
- Mutual exclusivity validation: Cannot use both comma-separated file list and `--dir` with `--consolidate`
|
|
159
|
+
- **Enhanced Context-Sensitive Help System**: Mode-specific help displays only relevant options
|
|
160
|
+
- `ruby_spriter --video --help`: Shows video mode options (spritesheet generation, processing, output)
|
|
161
|
+
- `ruby_spriter --image --help`: Shows image mode options (processing, frame extraction, output)
|
|
162
|
+
- `ruby_spriter --consolidate --help`: Shows consolidation options (input methods, validation, output)
|
|
163
|
+
- `ruby_spriter --batch --help`: Shows batch processing options (directory processing, applied options)
|
|
164
|
+
- `ruby_spriter --split --help`: Shows frame extraction options (split format, metadata behavior, output)
|
|
165
|
+
- General `--help`: Shows mode-specific help hints and directs users to detailed help
|
|
166
|
+
- **Parent-Child Option Hierarchy**: Visual hierarchy (└─) shows modifier options grouped under parent options
|
|
167
|
+
- `--interpolation`, `--sharpen*` modifiers shown under `--scale`
|
|
168
|
+
- `--fuzzy`, `--threshold`, `--grow` modifiers shown under `--remove-bg`
|
|
169
|
+
- `--override-md` modifier shown under `--split`
|
|
170
|
+
- `--validate-columns` modifier shown under `--consolidate --dir`
|
|
171
|
+
- Organized by function (Image Processing, Output Options) instead of by tool (GIMP Processing Options)
|
|
172
|
+
- **Frame Extraction** (`--extract`): Extract specific frames and create new spritesheet
|
|
173
|
+
- `--extract FRAMES`: Comma-separated frame numbers (e.g., `1,2,4,5,8`)
|
|
174
|
+
- `--columns NUM`: Specify output grid columns (default: 4)
|
|
175
|
+
- Supports duplicate frame numbers for animation sequences
|
|
176
|
+
- 1-indexed frame numbering (left-to-right, top-to-bottom)
|
|
177
|
+
- Requires spritesheet metadata (works with `--verify` output)
|
|
178
|
+
- Works with all `--image` processing options: `--scale`, `--remove-bg`, `--sharpen`, `--max-compress`
|
|
179
|
+
- Automatic output naming with `_extracted` suffix or custom via `--output`
|
|
180
|
+
- Temporary frames deleted after reassembly unless `--save-frames` specified
|
|
181
|
+
- Minimum 2 frames required
|
|
182
|
+
- Out-of-bounds validation against spritesheet metadata
|
|
183
|
+
- Mutual exclusivity with `--split`
|
|
184
|
+
- **Metadata Management** (`--add-meta`): Add spritesheet metadata to images without metadata
|
|
185
|
+
- `--add-meta R:C`: Specify grid layout (rows:columns, e.g., `4:4`)
|
|
186
|
+
- `--overwrite-meta`: Replace existing metadata
|
|
187
|
+
- `--frames COUNT`: Custom frame count for partial grids (fewer frames than grid size)
|
|
188
|
+
- In-place modification by default (respects `--overwrite` flag)
|
|
189
|
+
- Optional `--output` for copying to new file
|
|
190
|
+
- Dimension validation: Image dimensions must divide evenly by grid
|
|
191
|
+
- Enables `--extract`, `--consolidate`, `--verify`, `--split` on external spritesheets
|
|
192
|
+
- Standalone mode: Cannot combine with `--scale`, `--remove-bg`, `--sharpen`
|
|
193
|
+
- **Enhanced `--save-frames`**: Now works with both `--video` and `--extract`
|
|
194
|
+
- **New Modules**:
|
|
195
|
+
- `BatchProcessor` (lib/ruby_spriter/batch_processor.rb): Orchestrates batch video processing
|
|
196
|
+
- `CompressionManager` (lib/ruby_spriter/compression_manager.rb): Handles PNG compression with metadata preservation
|
|
197
|
+
- **New Public Method**: `Consolidator#find_spritesheets_in_directory(directory)` for directory scanning
|
|
198
|
+
- **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)
|
|
199
|
+
|
|
200
|
+
#### Changed
|
|
201
|
+
- **CLI**: Updated `--consolidate` description to mention `--dir` option
|
|
202
|
+
- **CLI**: Renamed "GIMP Processing Options" to "Processing Options" for tool-agnostic organization
|
|
203
|
+
- **CLI**: Updated image mode help with Frame Extraction & Reassembly section
|
|
204
|
+
- **CLI**: Added Metadata Management section to image mode help
|
|
205
|
+
- **Processor**: Refactored consolidation workflow to support both file list and directory modes
|
|
206
|
+
- **Test Suite**: Increased from 274 to 365 examples (all passing), 75.8% line coverage
|
|
207
|
+
- **CLI**: Added parent-child visual hierarchy to all context-sensitive help displays
|
|
208
|
+
- **CLI**: Corrected `--sharpen` to show as standalone option (not under `--scale`)
|
|
209
|
+
|
|
210
|
+
#### Examples
|
|
211
|
+
```bash
|
|
212
|
+
# Get context-sensitive help for specific modes
|
|
213
|
+
ruby_spriter --video --help
|
|
214
|
+
ruby_spriter --image --help
|
|
215
|
+
ruby_spriter --consolidate --help
|
|
216
|
+
ruby_spriter --batch --help
|
|
217
|
+
ruby_spriter --split --help
|
|
218
|
+
|
|
219
|
+
# Process all videos in directory
|
|
220
|
+
ruby_spriter --batch --dir "videos/"
|
|
221
|
+
|
|
222
|
+
# Process with output to different directory
|
|
223
|
+
ruby_spriter --batch --dir "videos/" --outputdir "output/"
|
|
224
|
+
|
|
225
|
+
# Process and consolidate all results
|
|
226
|
+
ruby_spriter --batch --dir "videos/" --batch-consolidate
|
|
227
|
+
|
|
228
|
+
# Process with scaling and compression
|
|
229
|
+
ruby_spriter --batch --dir "videos/" --scale 50 --max-compress
|
|
230
|
+
|
|
231
|
+
# Compress video output
|
|
232
|
+
ruby_spriter --video "input.mp4" --max-compress
|
|
233
|
+
|
|
234
|
+
# Compress image processing output
|
|
235
|
+
ruby_spriter --image "sprite.png" --scale 50 --max-compress
|
|
236
|
+
|
|
237
|
+
# Directory-based consolidation
|
|
238
|
+
ruby_spriter --consolidate --dir "spritesheets/"
|
|
239
|
+
ruby_spriter --consolidate --dir "spritesheets/" --outputdir "output/"
|
|
240
|
+
ruby_spriter --consolidate --dir "spritesheets/" --max-compress
|
|
241
|
+
|
|
242
|
+
# File list consolidation still works
|
|
243
|
+
ruby_spriter --consolidate file1.png,file2.png,file3.png
|
|
244
|
+
|
|
245
|
+
# Extract specific frames and create new spritesheet
|
|
246
|
+
ruby_spriter --image sprite.png --extract 1,2,4,5,8 --columns 3
|
|
247
|
+
|
|
248
|
+
# Extract with duplicates for animation loops
|
|
249
|
+
ruby_spriter --image sprite.png --extract 1,1,2,2,3,3 --save-frames
|
|
250
|
+
|
|
251
|
+
# Extract and process
|
|
252
|
+
ruby_spriter --image sprite.png --extract 1,3,5,7 --scale 50 --sharpen
|
|
253
|
+
|
|
254
|
+
# Add metadata to external spritesheet
|
|
255
|
+
ruby_spriter --image sprite.png --add-meta 4:4
|
|
256
|
+
|
|
257
|
+
# Add metadata with partial grid
|
|
258
|
+
ruby_spriter --image sprite.png --add-meta 4:4 --frames 14 --output sprite_meta.png
|
|
259
|
+
|
|
260
|
+
# Replace existing metadata
|
|
261
|
+
ruby_spriter --image existing.png --add-meta 8:8 --overwrite-meta
|
|
262
|
+
|
|
263
|
+
# Workflow: Add metadata, then extract frames
|
|
264
|
+
ruby_spriter --image external.png --add-meta 4:4
|
|
265
|
+
ruby_spriter --image external.png --extract 1,5,9,13 --columns 2
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Closes #14, #16
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
15
272
|
## [0.6.6] - 2025-10-23
|
|
16
273
|
|
|
17
274
|
### 🔒 File Protection & Frame Extraction Release
|