@pixzle/cli 0.0.22 → 0.0.23

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.
Files changed (2) hide show
  1. package/README.md +70 -240
  2. package/package.json +13 -4
package/README.md CHANGED
@@ -10,30 +10,7 @@ npm install @pixzle/cli
10
10
 
11
11
  ## Usage
12
12
 
13
- The CLI provides two main commands: `shuffle` and `restore`.
14
-
15
- ### Global Help
16
-
17
- ```bash
18
- pixzle --help
19
- ```
20
-
21
- ```
22
- Usage: pixzle [options] [command]
23
-
24
- CLI tool for image fragmentation and restoration
25
-
26
- Options:
27
- -V, --version output the version number
28
- -h, --help display help for command
29
-
30
- Commands:
31
- shuffle [options] <images...> Fragment images
32
- restore [options] <fragments...> Restore fragmented images
33
- help [command] display help for command
34
- ```
35
-
36
- ### Shuffle Command
13
+ ### Shuffle
37
14
 
38
15
  Fragment images into multiple pieces.
39
16
 
@@ -41,240 +18,93 @@ Fragment images into multiple pieces.
41
18
  pixzle shuffle <images...> -o <output_directory> [options]
42
19
  ```
43
20
 
44
- #### Options
45
-
46
- | Option | Description | Required | Default |
47
- |--------|-------------|----------|---------|
48
- | `-o, --output <dir>` | Output directory for fragments and manifest | | - |
49
- | `-b, --block-size <size>` | Pixel block size (positive integer) | | 10 |
50
- | `-p, --prefix <prefix>` | Prefix for fragment files | | "img" |
51
- | `-s, --seed <seed>` | Random seed (integer) | | auto-generated |
52
- | `--preserve-name` | Preserve original file names | ❌ | false |
53
- | `--cross-image-shuffle` | Shuffle blocks across all images instead of within each image independently | ❌ | false (per-image shuffle by default) |
54
-
55
- #### Examples
56
-
57
- **Basic fragmentation:**
58
- ```bash
59
- pixzle shuffle image1.jpg image2.png -o ./fragments
60
- ```
61
-
62
- **Custom configuration:**
63
- ```bash
64
- pixzle shuffle *.jpg -o ./output -b 20 -p "my_fragment" --preserve-name
65
- ```
66
-
67
- **With seed for reproducible results:**
68
- ```bash
69
- pixzle shuffle image.png -o ./output -s 12345
70
- ```
21
+ | Option | Description | Default |
22
+ |--------|-------------|---------|
23
+ | `-o, --output <dir>` | Output directory (Required) | - |
24
+ | `-b, --block-size <number>` | Pixel block size | 8 |
25
+ | `-p, --prefix <prefix>` | Prefix for fragment files | "img" |
26
+ | `-s, --seed <seed>` | Random seed | auto |
27
+ | `--preserve-name` | Preserve original file names | false |
28
+ | `--cross-image-shuffle` | Shuffle blocks across all images | false |
71
29
 
72
- **Cross-image shuffle (shuffle blocks across all images):**
30
+ **Example:**
73
31
  ```bash
74
- pixzle shuffle image1.png image2.png image3.png -o ./output --cross-image-shuffle
32
+ pixzle shuffle input.png -o ./output
75
33
  ```
76
34
 
77
- #### Output Structure
78
-
79
- After fragmentation, the output directory will contain:
80
- ```
81
- output/
82
- ├── manifest.json # Metadata for restoration
83
- ├── fragment_0000.png # Fragment files
84
- ├── fragment_0001.png
85
- └── ...
86
- ```
35
+ ### Restore
87
36
 
88
- ### Restore Command
37
+ Restore fragmented images.
89
38
 
90
- Restore fragmented images using the manifest file or manual configuration.
39
+ #### Using Manifest
91
40
 
92
41
  ```bash
93
- pixzle restore <fragments...> -m <manifest_path> -o <output_directory> [options]
42
+ pixzle restore <fragments...> -m <manifest_path> -o <output_directory>
94
43
  ```
95
44
 
96
- #### Options
97
-
98
45
  | Option | Description | Required |
99
46
  |--------|-------------|----------|
100
- | `-m, --manifest <path>` | Path to the manifest.json file | ⚠️ |
101
- | `-o, --output <dir>` | Output directory for restored images | ✅ |
102
- | `-b, --block-size <number>` | Pixel block size (positive integer) | ❌ (required if manifest missing) |
103
- | `-s, --seed <number>` | Random seed (integer) | ❌ (required if manifest missing) |
104
- | `-w, --width <number>` | Image width | ❌ (required if manifest missing) |
105
- | `-h, --height <number>` | Image height | ❌ (required if manifest missing) |
106
-
107
- > [!NOTE]
108
- > When using manual options (`-b`, `-s`, `-w`, `-h`), only a single image can be restored.
109
-
110
- #### Examples
111
-
112
- **Basic restoration (using manifest):**
113
- ```bash
114
- pixzle restore ./fragments/*.png -m ./fragments/manifest.json -o ./restored
115
- ```
47
+ | `-m, --manifest <path>` | Path to manifest.json | |
48
+ | `-o, --output <dir>` | Output directory | ✅ |
116
49
 
117
- **Manual restoration (without manifest):**
50
+ **Example:**
118
51
  ```bash
119
- pixzle restore ./fragment.png -o ./restored -b 10 -s 12345 -w 500 -h 500
52
+ pixzle restore ./output/*.png -m ./output/manifest.json -o ./restored
120
53
  ```
121
54
 
122
- **Specific fragments:**
123
- ```bash
124
- pixzle restore fragment_0000.png fragment_0001.png fragment_0002.png -m manifest.json -o ./output
125
- ```
126
-
127
- ## Error Handling
128
-
129
- The CLI provides clear error messages for common issues:
130
-
131
- - **File not found**: When input images or manifest don't exist
132
- - **Invalid options**: When required options are missing or invalid
133
- - **Restoration errors**: When fragments are corrupted or manifest doesn't match
134
- - **Permission errors**: When output directory cannot be created
135
-
136
- ## Examples Workflow
137
-
138
- ### Complete Workflow Example
139
-
140
- 1. **Prepare images:**
141
- ```bash
142
- ls images/
143
- # photo1.jpg photo2.png document.pdf
144
- ```
145
-
146
- 2. **Fragment images:**
147
- ```bash
148
- pixzle shuffle images/photo1.jpg images/photo2.png -o ./backup --preserve-name
149
- ```
150
- ```
151
- 🔀 Starting image fragmentation...
152
- ✅ Images fragmented successfully to: /path/to/backup
153
- ```
55
+ #### Manual Configuration (Single Image)
154
56
 
155
- 3. **Check output:**
156
- ```bash
157
- ls backup/
158
- # manifest.json fragment_0000.png fragment_0001.png fragment_0002.png fragment_0003.png
159
- ```
160
-
161
- 4. **Restore images:**
162
- ```bash
163
- pixzle restore backup/*.png -m backup/manifest.json -o ./restored
164
- ```
165
- ```
166
- 🔀 Starting image restoration...
167
- ✅ Images restored successfully to: /path/to/restored
168
- ```
169
-
170
- 5. **Verify restoration:**
171
- ```bash
172
- ls restored/
173
- # photo1.jpg photo2.png
174
- ```
175
-
176
- ### Advanced Configuration Example
177
-
178
- For custom fragmentation:
179
-
180
- ```bash
181
- # Fragment with custom settings
182
- pixzle shuffle sensitive/*.jpg \
183
- -o ./vault \
184
- -b 5 \
185
- -p "secure_chunk" \
186
- -s 42 \
187
- --preserve-name
188
-
189
- # The output will use smaller blocks (5x5 pixels) and custom naming
190
- ```
191
-
192
- ## Integration with Scripts
193
-
194
- ### Bash Script Example
57
+ Restore a single image without a manifest file.
195
58
 
196
59
  ```bash
197
- #!/bin/bash
198
-
199
- # Backup script
200
- IMAGES_DIR="./photos"
201
- BACKUP_DIR="./backup"
202
-
203
- # Create backup
204
- echo "Creating backup..."
205
- pixzle shuffle "$IMAGES_DIR"/*.{jpg,png} \
206
- -o "$BACKUP_DIR" \
207
- --preserve-name
208
-
209
- if [ $? -eq 0 ]; then
210
- echo "✅ Backup completed successfully"
211
- # Optionally remove original files or move them
212
- else
213
- echo "❌ Backup failed"
214
- exit 1
215
- fi
216
- ```
217
-
218
- ### Recovery Script Example
219
-
220
- ```bash
221
- #!/bin/bash
222
-
223
- # Recovery script
224
- BACKUP_DIR="./backup"
225
- RESTORE_DIR="./recovered_photos"
226
-
227
- # Restore from backup
228
- echo "Restoring from backup..."
229
- pixzle restore "$BACKUP_DIR"/fragment_*.png \
230
- -m "$BACKUP_DIR/manifest.json" \
231
- -o "$RESTORE_DIR"
232
-
233
- if [ $? -eq 0 ]; then
234
- echo "✅ Recovery completed successfully"
235
- else
236
- echo "❌ Recovery failed"
237
- exit 1
238
- fi
60
+ pixzle restore <fragment> -o <output_directory> -b <size> -s <seed> -w <width> -h <height>
239
61
  ```
240
62
 
241
- ## Development
242
-
243
- ### Building from Source
244
-
245
- ```bash
246
- # Clone the repository
247
- git clone https://github.com/tuki0918/pixzle.git
248
- cd pixzle
249
-
250
- # Install dependencies
251
- npm install
252
-
253
- # Build the CLI
254
- npm run build
255
-
256
- # Test the CLI
257
- cd packages/cli
258
- npm test
259
- ```
260
-
261
- ### Running in Development Mode
262
-
263
- ```bash
264
- cd packages/cli
265
- npm run dev -- shuffle --help
266
- ```
267
-
268
- ## Related Packages
269
-
270
- - [`@pixzle/core`](../core) - Core fragmentation logic
271
- - [`@pixzle/node`](../node) - Node.js implementation
272
- - [`@pixzle/browser`](../browser) - Browser implementation (coming soon)
273
-
274
- ## License
275
-
276
- See the [LICENSE](../../LICENSE) file in the root directory.
277
-
278
- ## Support
279
-
280
- For issues and questions, please visit the [GitHub repository](https://github.com/tuki0918/pixzle/issues).
63
+ | Option | Description | Required |
64
+ |--------|-------------|----------|
65
+ | `-o, --output <dir>` | Output directory | ✅ |
66
+ | `-b, --block-size <number>` | Pixel block size | ✅ |
67
+ | `-s, --seed <number>` | Random seed | ✅ |
68
+ | `-w, --width <number>` | Image width | ✅ |
69
+ | `-h, --height <number>` | Image height | ✅ |
70
+
71
+ **Example:**
72
+ ```bash
73
+ pixzle restore ./fragmented.png -o ./restored -b 10 -s 12345 -w 500 -h 500
74
+ ```
75
+
76
+
77
+ ## Manifest Structure
78
+
79
+ <details>
80
+ <summary>manifest.json</summary>
81
+
82
+ ```json
83
+ {
84
+ "id": "631631d5-bcaa-40ac-9c1e-efd6e89e4600",
85
+ "version": "0.0.0",
86
+ "timestamp": "2025-12-04T16:08:41.924Z",
87
+ "config": {
88
+ "blockSize": 8,
89
+ "prefix": "img",
90
+ "seed": 214448,
91
+ "preserveName": false,
92
+ "crossImageShuffle": false
93
+ },
94
+ "images": [
95
+ {
96
+ "w": 500,
97
+ "h": 500
98
+ },
99
+ {
100
+ "w": 400,
101
+ "h": 600
102
+ },
103
+ {
104
+ "w": 600,
105
+ "h": 400
106
+ }
107
+ ]
108
+ }
109
+ ```
110
+ </details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixzle/cli",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "CLI implementation of image fragmentation and restoration",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,16 @@
11
11
  "files": [
12
12
  "dist"
13
13
  ],
14
- "keywords": [],
14
+ "keywords": [
15
+ "pixzle",
16
+ "image",
17
+ "fragmentation",
18
+ "restoration",
19
+ "shuffle",
20
+ "obfuscation",
21
+ "cli",
22
+ "tool"
23
+ ],
15
24
  "author": "tuki0918",
16
25
  "repository": {
17
26
  "type": "git",
@@ -24,8 +33,8 @@
24
33
  },
25
34
  "dependencies": {
26
35
  "commander": "^12.1.0",
27
- "@pixzle/core": "0.0.22",
28
- "@pixzle/node": "0.0.22"
36
+ "@pixzle/core": "0.0.23",
37
+ "@pixzle/node": "0.0.23"
29
38
  },
30
39
  "devDependencies": {
31
40
  "@types/node": "^22.10.1",