ruby_spriter 0.6.5
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 +7 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +217 -0
- data/Gemfile +17 -0
- data/LICENSE +21 -0
- data/README.md +561 -0
- data/bin/ruby_spriter +20 -0
- data/lib/ruby_spriter/cli.rb +249 -0
- data/lib/ruby_spriter/consolidator.rb +146 -0
- data/lib/ruby_spriter/dependency_checker.rb +174 -0
- data/lib/ruby_spriter/gimp_processor.rb +664 -0
- data/lib/ruby_spriter/metadata_manager.rb +116 -0
- data/lib/ruby_spriter/platform.rb +82 -0
- data/lib/ruby_spriter/processor.rb +251 -0
- data/lib/ruby_spriter/utils/file_helper.rb +57 -0
- data/lib/ruby_spriter/utils/output_formatter.rb +65 -0
- data/lib/ruby_spriter/utils/path_helper.rb +59 -0
- data/lib/ruby_spriter/version.rb +7 -0
- data/lib/ruby_spriter/video_processor.rb +139 -0
- data/lib/ruby_spriter.rb +31 -0
- data/ruby_spriter.gemspec +42 -0
- data/spec/fixtures/image_without_metadata.png +0 -0
- data/spec/fixtures/spritesheet_4x2.png +0 -0
- data/spec/fixtures/spritesheet_4x4.png +0 -0
- data/spec/fixtures/spritesheet_6x2.png +0 -0
- data/spec/fixtures/spritesheet_with_metadata.png +0 -0
- data/spec/fixtures/test_video.mp4 +0 -0
- data/spec/ruby_spriter/cli_spec.rb +1142 -0
- data/spec/ruby_spriter/consolidator_spec.rb +375 -0
- data/spec/ruby_spriter/dependency_checker_spec.rb +0 -0
- data/spec/ruby_spriter/gimp_processor_spec.rb +425 -0
- data/spec/ruby_spriter/metadata_manager_spec.rb +0 -0
- data/spec/ruby_spriter/platform_spec.rb +82 -0
- data/spec/ruby_spriter/processor_spec.rb +0 -0
- data/spec/ruby_spriter/utils/file_helper_spec.rb +71 -0
- data/spec/ruby_spriter/utils/output_formatter_spec.rb +0 -0
- data/spec/ruby_spriter/utils/path_helper_spec.rb +78 -0
- data/spec/ruby_spriter/video_processor_spec.rb +0 -0
- data/spec/spec_helper.rb +41 -0
- metadata +88 -0
data/README.md
ADDED
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
# Ruby Spriter v0.6.5
|
|
2
|
+
|
|
3
|
+
[](https://www.ruby-lang.org/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[]()
|
|
6
|
+
|
|
7
|
+
**Professional MP4 to Spritesheet Converter with Advanced Image Processing**
|
|
8
|
+
|
|
9
|
+
A powerful cross-platform Ruby tool for creating high-quality spritesheets from video files and processing them with professional-grade image manipulation. Perfect for game development workflows, particularly with Godot Engine.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## โจ Features
|
|
14
|
+
|
|
15
|
+
### Core Capabilities
|
|
16
|
+
- ๐ฌ **Video to Spritesheet** - Extract frames from MP4 videos using FFmpeg
|
|
17
|
+
- ๐ผ๏ธ **Advanced Image Processing** - Scale, sharpen, and remove backgrounds with precision
|
|
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
|
|
21
|
+
- ๐ **Cross-Platform** - Works seamlessly on Windows, Linux, and macOS
|
|
22
|
+
- ๐งช **Production Ready** - Comprehensive RSpec test coverage
|
|
23
|
+
|
|
24
|
+
### Image Processing Features
|
|
25
|
+
|
|
26
|
+
#### **Scaling with Quality Control**
|
|
27
|
+
- Percentage-based resizing
|
|
28
|
+
- **5 Interpolation Methods:**
|
|
29
|
+
- `none` - No interpolation (nearest neighbor)
|
|
30
|
+
- `linear` - Fast bilinear interpolation
|
|
31
|
+
- `cubic` - High-quality bicubic interpolation
|
|
32
|
+
- `nohalo` - Advanced edge-preserving (default)
|
|
33
|
+
- `lohalo` - Maximum quality, slower
|
|
34
|
+
|
|
35
|
+
#### **Sharpening (Unsharp Mask)**
|
|
36
|
+
- Restore edge definition after scaling
|
|
37
|
+
- **Configurable Parameters:**
|
|
38
|
+
- `radius` - Effect size in pixels (default: 2.0)
|
|
39
|
+
- `gain` - Sharpening intensity (default: 0.5, range: 0.0-2.0+)
|
|
40
|
+
- `threshold` - Minimum change threshold (default: 0.03, range: 0.0-1.0)
|
|
41
|
+
- Powered by ImageMagick for consistent results
|
|
42
|
+
|
|
43
|
+
#### **Background Removal**
|
|
44
|
+
- **Fuzzy Select** - Contiguous color regions (default)
|
|
45
|
+
- **Global Color Select** - All matching pixels across image
|
|
46
|
+
- Adjustable selection growth and feathering
|
|
47
|
+
- **Smart Operation Order** - Automatically optimizes quality
|
|
48
|
+
|
|
49
|
+
#### **Operation Order Optimization**
|
|
50
|
+
- `scale_first` (default) - Scale then remove background
|
|
51
|
+
- `bg_first` - Remove background then scale (auto-enabled when both operations used)
|
|
52
|
+
- Automatic optimization for best quality
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## ๐ Requirements
|
|
57
|
+
|
|
58
|
+
### External Dependencies
|
|
59
|
+
|
|
60
|
+
| Tool | Version | Purpose |
|
|
61
|
+
|------|---------|---------|
|
|
62
|
+
| **FFmpeg** | Latest | Video frame extraction |
|
|
63
|
+
| **FFprobe** | Latest | Video analysis (included with FFmpeg) |
|
|
64
|
+
| **ImageMagick** | 7.x+ | Metadata and sharpening |
|
|
65
|
+
| **GIMP** | 3.x (or 2.10) | Scaling and background removal |
|
|
66
|
+
|
|
67
|
+
### Ruby Version
|
|
68
|
+
- Ruby 2.7.0 or higher
|
|
69
|
+
- No runtime gem dependencies (uses Ruby standard library)
|
|
70
|
+
|
|
71
|
+
### Supported File Formats
|
|
72
|
+
- **Video Input**: MP4 only
|
|
73
|
+
- **Image Input/Output**: PNG only
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ๐ Installation
|
|
78
|
+
|
|
79
|
+
### Prerequisites (All Installation Methods)
|
|
80
|
+
|
|
81
|
+
Ruby Spriter requires these external tools for video and image processing:
|
|
82
|
+
|
|
83
|
+
| Tool | Purpose | Version |
|
|
84
|
+
|------|---------|---------|
|
|
85
|
+
| **FFmpeg** | Video frame extraction | Any recent version |
|
|
86
|
+
| **ImageMagick** | Image manipulation & metadata | 7.x or 6.9+ |
|
|
87
|
+
| **GIMP** | Advanced image processing | 3.x (or 2.10) |
|
|
88
|
+
|
|
89
|
+
#### Installing Prerequisites
|
|
90
|
+
|
|
91
|
+
**Windows (Chocolatey)**
|
|
92
|
+
```powershell
|
|
93
|
+
choco install ffmpeg imagemagick gimp -y
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**macOS (Homebrew)**
|
|
97
|
+
```bash
|
|
98
|
+
brew install ffmpeg imagemagick gimp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Linux (Ubuntu/Debian)**
|
|
102
|
+
```bash
|
|
103
|
+
sudo apt update && sudo apt install ffmpeg imagemagick gimp -y
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Choose Your Installation Method
|
|
109
|
+
|
|
110
|
+
#### ๐ฆ **Option A: RubyGems (Recommended)**
|
|
111
|
+
|
|
112
|
+
Install the published gem from RubyGems.org:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
gem install ruby_spriter
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Requirements**: Ruby 2.7 or higher
|
|
119
|
+
**Best for**: All platforms (Windows, macOS, Linux), automated workflows
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
#### ๐ ๏ธ **Option B: From Source (Development)**
|
|
124
|
+
|
|
125
|
+
Clone and build from source:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Clone repository
|
|
129
|
+
git clone https://github.com/scooter-indie/ruby-spriter.git
|
|
130
|
+
cd ruby-spriter
|
|
131
|
+
|
|
132
|
+
# Install development dependencies
|
|
133
|
+
bundle install
|
|
134
|
+
|
|
135
|
+
# Build and install gem locally
|
|
136
|
+
gem build ruby_spriter.gemspec
|
|
137
|
+
gem install ruby_spriter-0.6.5.gem
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Best for**: Contributors, developers wanting latest code
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### Verify Installation
|
|
145
|
+
|
|
146
|
+
After installing Ruby Spriter via any method:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Check Ruby Spriter version
|
|
150
|
+
ruby_spriter --version
|
|
151
|
+
|
|
152
|
+
# Verify all dependencies
|
|
153
|
+
ruby_spriter --check-dependencies
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The `--check-dependencies` command checks all external tools:
|
|
157
|
+
- โ
**Tool found**: Shows version and path
|
|
158
|
+
- โ **Tool missing**: Shows platform-specific installation commands
|
|
159
|
+
|
|
160
|
+
Example output:
|
|
161
|
+
```
|
|
162
|
+
Checking external dependencies...
|
|
163
|
+
|
|
164
|
+
โ FFmpeg found: 6.0 (C:\ProgramData\chocolatey\bin\ffmpeg.exe)
|
|
165
|
+
โ FFprobe found: 6.0 (C:\ProgramData\chocolatey\bin\ffprobe.exe)
|
|
166
|
+
โ ImageMagick (convert) found: 7.1.1-15 (C:\Program Files\ImageMagick\convert.exe)
|
|
167
|
+
โ ImageMagick (identify) found: 7.1.1-15 (C:\Program Files\ImageMagick\identify.exe)
|
|
168
|
+
โ GIMP found: 2.99.16 (C:\Program Files\GIMP 3\bin\gimp-2.99.exe)
|
|
169
|
+
|
|
170
|
+
All dependencies are installed!
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## ๐ฏ Quick Start
|
|
176
|
+
|
|
177
|
+
### Basic Video to Spritesheet
|
|
178
|
+
```bash
|
|
179
|
+
# Create 4x4 grid with 16 frames
|
|
180
|
+
ruby_spriter --video input.mp4
|
|
181
|
+
|
|
182
|
+
# Custom grid and frame count
|
|
183
|
+
ruby_spriter --video input.mp4 --frames 32 --columns 8
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### High-Quality Scaling
|
|
187
|
+
```bash
|
|
188
|
+
# Scale to 50% with best quality interpolation
|
|
189
|
+
ruby_spriter --video input.mp4 --scale 50 --interpolation nohalo
|
|
190
|
+
|
|
191
|
+
# Scale and sharpen for crisp results
|
|
192
|
+
ruby_spriter --video input.mp4 --scale 50 --sharpen
|
|
193
|
+
|
|
194
|
+
# Custom sharpening for maximum detail
|
|
195
|
+
ruby_spriter --video input.mp4 --scale 50 --sharpen \
|
|
196
|
+
--sharpen-gain 1.5 --sharpen-radius 3.0
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Background Removal
|
|
200
|
+
```bash
|
|
201
|
+
# Remove background (auto-optimized order)
|
|
202
|
+
ruby_spriter --video input.mp4 --scale 50 --remove-bg
|
|
203
|
+
|
|
204
|
+
# Process existing spritesheet
|
|
205
|
+
ruby_spriter --image sprite.png --remove-bg --fuzzy
|
|
206
|
+
|
|
207
|
+
# Fine-tune background removal
|
|
208
|
+
ruby_spriter --image sprite.png --remove-bg \
|
|
209
|
+
--threshold 1.5 --grow 2
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Advanced Workflows
|
|
213
|
+
```bash
|
|
214
|
+
# Complete processing pipeline
|
|
215
|
+
ruby_spriter --video input.mp4 \
|
|
216
|
+
--frames 64 --columns 8 \
|
|
217
|
+
--scale 50 --interpolation nohalo \
|
|
218
|
+
--remove-bg \
|
|
219
|
+
--sharpen --sharpen-gain 0.8
|
|
220
|
+
|
|
221
|
+
# Process existing image with quality enhancement
|
|
222
|
+
ruby_spriter --image large_sprite.png \
|
|
223
|
+
--scale 50 --interpolation lohalo \
|
|
224
|
+
--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
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## ๐ Usage
|
|
234
|
+
|
|
235
|
+
### Command-Line Options
|
|
236
|
+
|
|
237
|
+
#### **Input Options**
|
|
238
|
+
```bash
|
|
239
|
+
-v, --video FILE Input video file (MP4 only)
|
|
240
|
+
-i, --image FILE Input image file (PNG only)
|
|
241
|
+
--consolidate FILES Consolidate multiple spritesheets (PNG only, comma-separated)
|
|
242
|
+
--verify FILE Verify spritesheet metadata (PNG only)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### **Spritesheet Options**
|
|
246
|
+
```bash
|
|
247
|
+
-o, --output FILE Output file path
|
|
248
|
+
-f, --frames COUNT Number of frames to extract (default: 16)
|
|
249
|
+
-c, --columns COUNT Grid columns (default: 4)
|
|
250
|
+
-w, --width PIXELS Max frame width (default: 320)
|
|
251
|
+
-b, --background COLOR Tile background: black, white (default: black)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### **Scaling Options**
|
|
255
|
+
```bash
|
|
256
|
+
-s, --scale PERCENT Scale image by percentage
|
|
257
|
+
--interpolation METHOD Interpolation: none, linear, cubic, nohalo, lohalo
|
|
258
|
+
(default: nohalo)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### **Sharpening Options**
|
|
262
|
+
```bash
|
|
263
|
+
--sharpen Apply unsharp mask after scaling
|
|
264
|
+
--sharpen-radius VALUE Radius in pixels (default: 2.0)
|
|
265
|
+
--sharpen-gain VALUE Gain/strength (default: 0.5, range: 0.0-2.0+)
|
|
266
|
+
--sharpen-threshold VALUE Threshold fraction (default: 0.03, range: 0.0-1.0)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### **Background Removal Options**
|
|
270
|
+
```bash
|
|
271
|
+
-r, --remove-bg Remove background using GIMP
|
|
272
|
+
-t, --threshold VALUE Feather radius (default: 0.0)
|
|
273
|
+
-g, --grow PIXELS Pixels to grow selection (default: 1)
|
|
274
|
+
--fuzzy Use fuzzy select (contiguous) - DEFAULT
|
|
275
|
+
--no-fuzzy Use global color select (all matching)
|
|
276
|
+
--order ORDER Operation order: scale_first, bg_first
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### **Preset Configurations**
|
|
280
|
+
```bash
|
|
281
|
+
--preset thumbnail 3ร? grid, 9 frames, 240px wide
|
|
282
|
+
--preset preview 4ร? grid, 16 frames, 400px wide
|
|
283
|
+
--preset detailed 10ร? grid, 50 frames, 320px wide
|
|
284
|
+
--preset contact 8ร? grid, 64 frames, 160px wide
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### **Other Options**
|
|
288
|
+
```bash
|
|
289
|
+
--keep-temp Keep temporary files for debugging
|
|
290
|
+
--debug Enable verbose output + keep temp files
|
|
291
|
+
--check-dependencies Check if all required external tools are installed
|
|
292
|
+
--version Show version information
|
|
293
|
+
-h, --help Show help message
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## ๐ก Use Cases
|
|
299
|
+
|
|
300
|
+
### Game Development with Godot
|
|
301
|
+
|
|
302
|
+
#### Character Animation Sprites
|
|
303
|
+
```bash
|
|
304
|
+
# Export from Blender/animation software to MP4
|
|
305
|
+
# Convert to optimized spritesheet with background removal
|
|
306
|
+
|
|
307
|
+
ruby_spriter --video character_walk.mp4 \
|
|
308
|
+
--frames 16 --columns 4 \
|
|
309
|
+
--scale 50 --remove-bg \
|
|
310
|
+
--sharpen
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### VFX and Particle Effects
|
|
314
|
+
```bash
|
|
315
|
+
# High frame count for smooth effects
|
|
316
|
+
ruby_spriter --video explosion.mp4 \
|
|
317
|
+
--frames 64 --columns 8 \
|
|
318
|
+
--scale 75 --interpolation nohalo
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### Multiple Character Directions
|
|
322
|
+
```bash
|
|
323
|
+
# Consolidate walk cycles for 8 directions
|
|
324
|
+
ruby_spriter --consolidate \
|
|
325
|
+
walk_n.png,walk_ne.png,walk_e.png,walk_se.png,\
|
|
326
|
+
walk_s.png,walk_sw.png,walk_w.png,walk_nw.png \
|
|
327
|
+
--output character_walk_all.png
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Quality Enhancement
|
|
331
|
+
```bash
|
|
332
|
+
# Downscale high-res renders while maintaining sharpness
|
|
333
|
+
ruby_spriter --image 4k_sprite.png \
|
|
334
|
+
--scale 25 --interpolation lohalo \
|
|
335
|
+
--sharpen --sharpen-gain 1.0 \
|
|
336
|
+
--output hd_sprite.png
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## ๐ง Advanced Features
|
|
342
|
+
|
|
343
|
+
### Metadata Management
|
|
344
|
+
|
|
345
|
+
Ruby Spriter embeds grid information directly into PNG files:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Metadata is automatically embedded during creation
|
|
349
|
+
ruby_spriter --video input.mp4 --frames 32 --columns 8
|
|
350
|
+
|
|
351
|
+
# Verify metadata in existing spritesheet
|
|
352
|
+
ruby_spriter --verify spritesheet.png
|
|
353
|
+
|
|
354
|
+
# Output:
|
|
355
|
+
# Spritesheet Metadata Verification
|
|
356
|
+
# ================================
|
|
357
|
+
# File: spritesheet.png
|
|
358
|
+
# Columns: 8
|
|
359
|
+
# Frames: 32
|
|
360
|
+
# Rows: 4 (calculated)
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Operation Order Optimization
|
|
364
|
+
|
|
365
|
+
When both scaling and background removal are requested, Ruby Spriter automatically uses the optimal order:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# This automatically removes background BEFORE scaling
|
|
369
|
+
ruby_spriter --video input.mp4 --scale 50 --remove-bg
|
|
370
|
+
|
|
371
|
+
# Why? Background removal works better at full resolution,
|
|
372
|
+
# then scaling smooths any rough edges
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Override if needed:
|
|
376
|
+
```bash
|
|
377
|
+
ruby_spriter --video input.mp4 --scale 50 --remove-bg --order scale_first
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Debug Mode
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
# See exactly what's happening
|
|
384
|
+
ruby_spriter --video input.mp4 --scale 50 --sharpen --debug
|
|
385
|
+
|
|
386
|
+
# Output includes:
|
|
387
|
+
# - Dependency check results
|
|
388
|
+
# - Temp directory location
|
|
389
|
+
# - GIMP script paths and logs
|
|
390
|
+
# - ImageMagick commands
|
|
391
|
+
# - Processing timestamps
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## ๐๏ธ Architecture
|
|
397
|
+
|
|
398
|
+
### Four Processing Modes
|
|
399
|
+
|
|
400
|
+
1. **Video Mode** - MP4 โ Spritesheet โ Optional Processing
|
|
401
|
+
2. **Image Mode** - PNG โ Processing โ Enhanced PNG
|
|
402
|
+
3. **Consolidate Mode** - Multiple PNGs โ Combined Spritesheet
|
|
403
|
+
4. **Verify Mode** - Read and display embedded metadata
|
|
404
|
+
|
|
405
|
+
### Processing Pipeline
|
|
406
|
+
|
|
407
|
+
**Video Mode:**
|
|
408
|
+
```
|
|
409
|
+
Input Video (MP4)
|
|
410
|
+
โ
|
|
411
|
+
[FFmpeg] Frame Extraction + Spritesheet Assembly
|
|
412
|
+
โ
|
|
413
|
+
[ImageMagick] Metadata Embedding
|
|
414
|
+
โ
|
|
415
|
+
[GIMP] Scale and/or Background Removal (optional)
|
|
416
|
+
โ
|
|
417
|
+
[ImageMagick] Sharpening (optional)
|
|
418
|
+
โ
|
|
419
|
+
Output PNG with Metadata
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Image Mode:**
|
|
423
|
+
```
|
|
424
|
+
Input Image (PNG)
|
|
425
|
+
โ
|
|
426
|
+
[GIMP] Scale and/or Background Removal (optional)
|
|
427
|
+
โ
|
|
428
|
+
[ImageMagick] Sharpening (optional)
|
|
429
|
+
โ
|
|
430
|
+
[ImageMagick] Metadata Preservation
|
|
431
|
+
โ
|
|
432
|
+
Output PNG with Metadata
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Consolidate Mode:**
|
|
436
|
+
```
|
|
437
|
+
Multiple Input PNGs
|
|
438
|
+
โ
|
|
439
|
+
[ImageMagick] Read Metadata from Each
|
|
440
|
+
โ
|
|
441
|
+
[ImageMagick] Validate Column Compatibility
|
|
442
|
+
โ
|
|
443
|
+
[ImageMagick] Vertical Stacking (append)
|
|
444
|
+
โ
|
|
445
|
+
[ImageMagick] Embed Combined Metadata
|
|
446
|
+
โ
|
|
447
|
+
Output Consolidated PNG
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Key Components
|
|
451
|
+
|
|
452
|
+
- **Processor** - Main orchestration
|
|
453
|
+
- **VideoProcessor** - FFmpeg integration
|
|
454
|
+
- **GimpProcessor** - GIMP batch scripting
|
|
455
|
+
- **Consolidator** - Multi-sheet merging
|
|
456
|
+
- **MetadataManager** - PNG metadata handling
|
|
457
|
+
- **DependencyChecker** - Tool detection
|
|
458
|
+
- **Platform** - Cross-platform abstraction
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## ๐งช Development
|
|
463
|
+
|
|
464
|
+
### Setup Development Environment
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# Clone and setup
|
|
468
|
+
git clone https://github.com/scooter-indie/ruby-spriter.git
|
|
469
|
+
cd ruby-spriter
|
|
470
|
+
bundle install
|
|
471
|
+
|
|
472
|
+
# Run tests
|
|
473
|
+
bundle exec rspec
|
|
474
|
+
|
|
475
|
+
# Run specific test
|
|
476
|
+
bundle exec rspec spec/ruby_spriter/processor_spec.rb
|
|
477
|
+
|
|
478
|
+
# Check code coverage
|
|
479
|
+
bundle exec rspec
|
|
480
|
+
# Opens coverage/index.html
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Project Structure
|
|
484
|
+
|
|
485
|
+
```
|
|
486
|
+
ruby-spriter/
|
|
487
|
+
โโโ bin/
|
|
488
|
+
โ โโโ ruby_spriter # CLI executable
|
|
489
|
+
โโโ lib/
|
|
490
|
+
โ โโโ ruby_spriter/
|
|
491
|
+
โ โโโ cli.rb # Command-line interface
|
|
492
|
+
โ โโโ processor.rb # Main orchestration
|
|
493
|
+
โ โโโ video_processor.rb
|
|
494
|
+
โ โโโ gimp_processor.rb
|
|
495
|
+
โ โโโ consolidator.rb
|
|
496
|
+
โ โโโ metadata_manager.rb
|
|
497
|
+
โ โโโ dependency_checker.rb
|
|
498
|
+
โ โโโ platform.rb
|
|
499
|
+
โ โโโ utils/ # Helper modules
|
|
500
|
+
โโโ spec/ # RSpec tests
|
|
501
|
+
โโโ CLAUDE.md # Developer documentation
|
|
502
|
+
โโโ README.md # This file
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### Running from Source
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
# Without installing gem
|
|
509
|
+
ruby -Ilib bin/ruby_spriter --video test.mp4
|
|
510
|
+
|
|
511
|
+
# Or use bundle exec
|
|
512
|
+
bundle exec ruby_spriter --video test.mp4
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## ๐ค Contributing
|
|
518
|
+
|
|
519
|
+
Contributions are welcome! Please:
|
|
520
|
+
|
|
521
|
+
1. Fork the repository
|
|
522
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
523
|
+
3. Write tests for your changes
|
|
524
|
+
4. Ensure all tests pass (`bundle exec rspec`)
|
|
525
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
526
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
527
|
+
7. Open a Pull Request
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## ๐ License
|
|
532
|
+
|
|
533
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## ๐ Links
|
|
538
|
+
|
|
539
|
+
- **GitHub**: [https://github.com/scooter-indie/ruby-spriter](https://github.com/scooter-indie/ruby-spriter)
|
|
540
|
+
- **Issues**: [https://github.com/scooter-indie/ruby-spriter/issues](https://github.com/scooter-indie/ruby-spriter/issues)
|
|
541
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## ๐ Acknowledgments
|
|
546
|
+
|
|
547
|
+
- **FFmpeg** - Video processing foundation
|
|
548
|
+
- **GIMP** - Professional image manipulation
|
|
549
|
+
- **ImageMagick** - Metadata and image operations
|
|
550
|
+
- **Ruby Community** - Excellent standard library
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## ๐ See Also
|
|
555
|
+
|
|
556
|
+
- [CLAUDE.md](CLAUDE.md) - Detailed developer documentation and architecture guide
|
|
557
|
+
- [CHANGELOG.md](CHANGELOG.md) - Version history and release notes
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
**Made with โค๏ธ for game developers**
|
data/bin/ruby_spriter
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Add lib directory to load path
|
|
5
|
+
lib = File.expand_path('../lib', __dir__)
|
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
7
|
+
|
|
8
|
+
require 'ruby_spriter'
|
|
9
|
+
|
|
10
|
+
# Run the CLI
|
|
11
|
+
begin
|
|
12
|
+
RubySpriter::CLI.start(ARGV)
|
|
13
|
+
rescue Interrupt
|
|
14
|
+
puts "\n\nโ ๏ธ Process interrupted by user"
|
|
15
|
+
exit 130
|
|
16
|
+
rescue StandardError => e
|
|
17
|
+
puts "\nโ ERROR: #{e.message}"
|
|
18
|
+
puts e.backtrace.join("\n") if ENV['DEBUG']
|
|
19
|
+
exit 1
|
|
20
|
+
end
|