@rosepetal/node-red-contrib-image-tools 1.2.3 → 1.3.0

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 (42) hide show
  1. package/.github/workflows/build-prebuild.yml +3 -0
  2. package/install.sh +8 -0
  3. package/node-red-contrib-image-tools/nodes/blend/add-bbs.html +219 -3
  4. package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +2 -1
  5. package/node-red-contrib-image-tools/nodes/blend/add-mask.html +258 -3
  6. package/node-red-contrib-image-tools/nodes/blend/add-mask.js +2 -1
  7. package/node-red-contrib-image-tools/nodes/blend/add-masks.html +183 -3
  8. package/node-red-contrib-image-tools/nodes/blend/add-masks.js +2 -1
  9. package/node-red-contrib-image-tools/nodes/blend/blend.html +308 -3
  10. package/node-red-contrib-image-tools/nodes/blend/blend.js +2 -1
  11. package/node-red-contrib-image-tools/nodes/io/folder-in.html +147 -3
  12. package/node-red-contrib-image-tools/nodes/io/folder-in.js +2 -1
  13. package/node-red-contrib-image-tools/nodes/io/image-in.html +81 -2
  14. package/node-red-contrib-image-tools/nodes/io/image-in.js +2 -1
  15. package/node-red-contrib-image-tools/nodes/io/image-out.html +197 -3
  16. package/node-red-contrib-image-tools/nodes/io/image-out.js +2 -1
  17. package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +375 -3
  18. package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +2 -1
  19. package/node-red-contrib-image-tools/nodes/mix/concat.html +222 -5
  20. package/node-red-contrib-image-tools/nodes/mix/concat.js +2 -1
  21. package/node-red-contrib-image-tools/nodes/mix/mosaic.html +284 -3
  22. package/node-red-contrib-image-tools/nodes/mix/mosaic.js +2 -1
  23. package/node-red-contrib-image-tools/nodes/specialized/cropBB.html +193 -3
  24. package/node-red-contrib-image-tools/nodes/specialized/cropBB.js +2 -1
  25. package/node-red-contrib-image-tools/nodes/specialized/image-align.html +260 -2
  26. package/node-red-contrib-image-tools/nodes/specialized/image-align.js +2 -1
  27. package/node-red-contrib-image-tools/nodes/transform/color-convert.html +144 -5
  28. package/node-red-contrib-image-tools/nodes/transform/color-convert.js +2 -1
  29. package/node-red-contrib-image-tools/nodes/transform/crop.html +213 -5
  30. package/node-red-contrib-image-tools/nodes/transform/crop.js +2 -1
  31. package/node-red-contrib-image-tools/nodes/transform/draw.html +128 -3
  32. package/node-red-contrib-image-tools/nodes/transform/draw.js +2 -1
  33. package/node-red-contrib-image-tools/nodes/transform/filter.html +344 -3
  34. package/node-red-contrib-image-tools/nodes/transform/filter.js +2 -1
  35. package/node-red-contrib-image-tools/nodes/transform/padding.html +292 -5
  36. package/node-red-contrib-image-tools/nodes/transform/padding.js +2 -1
  37. package/node-red-contrib-image-tools/nodes/transform/resize.html +177 -3
  38. package/node-red-contrib-image-tools/nodes/transform/resize.js +2 -1
  39. package/node-red-contrib-image-tools/nodes/transform/rotate.html +140 -5
  40. package/node-red-contrib-image-tools/nodes/transform/rotate.js +2 -1
  41. package/package.json +71 -71
  42. package/scripts/dual-register.js +267 -0
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('folder-in', {
2
+ var _rpNodeCfg = {
3
3
  category: 'RP Image',
4
4
  color: '#A6C8A6',
5
5
  defaults: {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  onclick: function() {
27
27
  const node = this;
28
- const label = this.name || "folder-in";
28
+ const label = this.name || "rp-folder-in";
29
29
 
30
30
  $.ajax({
31
31
  url: "folder-in/" + this.id,
@@ -102,7 +102,58 @@
102
102
  // Initialize visibility
103
103
  updateDebugWidthVisibility();
104
104
  }
105
- });
105
+ };
106
+ RED.nodes.registerType('rp-folder-in', _rpNodeCfg);
107
+ RED.nodes.registerType('folder-in', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
108
+ </script>
109
+
110
+ <script type="text/x-red" data-template-name="rp-folder-in">
111
+ <div class="form-row">
112
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
113
+ <input type="text" id="node-input-name" placeholder="Name">
114
+ </div>
115
+
116
+ <div class="form-row">
117
+ <label for="node-input-folderPath"><i class="fa fa-folder-open"></i> Folder Path</label>
118
+ <input type="text" id="node-input-folderPath" style="width: 70%;" placeholder="/path/to/image/folder">
119
+ <input type="hidden" id="node-input-folderPathType">
120
+ </div>
121
+
122
+ <hr>
123
+
124
+ <div class="form-row">
125
+ <label for="node-input-interval"><i class="fa fa-clock-o"></i> Interval (ms)</label>
126
+ <input type="text" id="node-input-interval" style="width: 120px;">
127
+ <input type="hidden" id="node-input-intervalType">
128
+ </div>
129
+
130
+ <div class="form-row">
131
+ <label for="node-input-mode"><i class="fa fa-repeat"></i> Mode</label>
132
+ <select id="node-input-mode" style="width: 200px;">
133
+ <option value="loop">Loop (repeat images)</option>
134
+ <option value="one-shot">One-shot (stop at end)</option>
135
+ </select>
136
+ </div>
137
+
138
+ <hr>
139
+
140
+ <div class="form-row">
141
+ <label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output to</label>
142
+ <input type="text" id="node-input-outputPath" style="width: 70%;">
143
+ <input type="hidden" id="node-input-outputPathType">
144
+ </div>
145
+
146
+ <!-- Debug Configuration -->
147
+ <div class="form-row">
148
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
149
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
150
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show loaded images</label>
151
+ </div>
152
+ <div class="form-row" id="debug-width-row" style="display: none;">
153
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
154
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
155
+ <input type="hidden" id="node-input-debugWidthType">
156
+ </div>
106
157
  </script>
107
158
 
108
159
  <script type="text/x-red" data-template-name="folder-in">
@@ -154,6 +205,99 @@
154
205
  </div>
155
206
  </script>
156
207
 
208
+ <script type="text/x-red" data-help-name="rp-folder-in">
209
+ <p>Scans a folder for image files and emits them one by one at configurable intervals. Features a toggle button to start/stop emission.</p>
210
+
211
+ <h3>Details</h3>
212
+ <p>This node reads all image files from a specified folder and emits them sequentially at a configurable rate. It can operate in two modes: loop (continuously repeat images) or one-shot (stop after all images). The node features a physical button on the left side (like the inject node) to start and stop the emission process.</p>
213
+
214
+ <p><strong>Supported Image Formats:</strong> JPEG, PNG, WebP, BMP, GIF, TIFF</p>
215
+
216
+ <h3>Properties</h3>
217
+ <dl class="message-properties">
218
+ <dt>Folder Path <span class="property-type">string | msg | flow | global</span></dt>
219
+ <dd>The path to the folder containing image files. Can be a static string (absolute or relative path) or dynamically resolved from message properties, flow context, or global context. The node will scan this folder and find all supported image files.</dd>
220
+
221
+ <dt>Interval (ms) <span class="property-type">number</span></dt>
222
+ <dd>The time interval in milliseconds between each image emission. For example, 1000 = 1 second between images. Minimum recommended: 100ms.</dd>
223
+
224
+ <dt>Mode <span class="property-type">loop | one-shot</span></dt>
225
+ <dd>
226
+ <ul>
227
+ <li><strong>Loop:</strong> After emitting the last image, restart from the first image and continue indefinitely until stopped.</li>
228
+ <li><strong>One-shot:</strong> Stop automatically after emitting all images once.</li>
229
+ </ul>
230
+ </dd>
231
+
232
+ <dt>Output to <span class="property-type">msg | flow | global</span></dt>
233
+ <dd>The location where the resulting image object will be stored. Defaults to <code>msg.payload</code>.</dd>
234
+
235
+ <dt>Debug <span class="property-type">boolean</span></dt>
236
+ <dd>Enable inline image preview display for debugging purposes.</dd>
237
+ </dl>
238
+
239
+ <h3>Button Control</h3>
240
+ <p>Click the button on the left side of the node to toggle between running and stopped states:</p>
241
+ <ul>
242
+ <li><strong>Stopped (grey):</strong> No images are being emitted. Click to start.</li>
243
+ <li><strong>Running (green):</strong> Images are being emitted at the configured interval. Click to stop.</li>
244
+ </ul>
245
+ <p><strong>Note:</strong> This node does not have an input connector. It operates independently using only the button control.</p>
246
+
247
+ <h3>Outputs</h3>
248
+ <p>The node sets the property specified in 'Output to' with the processed image object using the standard format:</p>
249
+ <pre>{
250
+ data: Buffer, // Raw pixel data
251
+ width: number, // Image width in pixels
252
+ height: number, // Image height in pixels
253
+ channels: number, // Channel count (1, 3, 4)
254
+ colorSpace: string, // "GRAY", "RGB", "RGBA"
255
+ dtype: string // "uint8"
256
+ }</pre>
257
+
258
+ <p>Additionally, each message includes metadata in <code>msg._folderIn</code>:</p>
259
+ <pre>{
260
+ fileName: string, // Name of the current image file
261
+ filePath: string, // Full path to the current image file
262
+ index: number, // Current image index (0-based)
263
+ total: number // Total number of images in folder
264
+ }</pre>
265
+
266
+ <h3>Examples</h3>
267
+ <ul>
268
+ <li><strong>Slideshow:</strong> Set folder to <code>/images/slideshow</code>, interval to 2000ms (2 seconds), mode to "loop" for continuous slideshow</li>
269
+ <li><strong>Batch Processing:</strong> Set mode to "one-shot" and connect to processing nodes to automatically process all images in a folder</li>
270
+ <li><strong>Animation Preview:</strong> Set interval to 100ms to quickly preview a sequence of images</li>
271
+ <li><strong>Dataset Loading:</strong> Use "one-shot" mode to load a complete dataset for AI/ML processing</li>
272
+ </ul>
273
+
274
+ <h3>Status Display</h3>
275
+ <p>The node displays its current state and progress:</p>
276
+ <ul>
277
+ <li><strong>Stopped:</strong> Node is not emitting images</li>
278
+ <li><strong>Scanning folder:</strong> Reading directory contents</li>
279
+ <li><strong>Loading [filename]:</strong> Currently loading an image</li>
280
+ <li><strong>[n/total]: [filename]:</strong> Successfully emitted image n of total</li>
281
+ <li><strong>Completed all images:</strong> One-shot mode finished</li>
282
+ <li><strong>Error:</strong> Error occurred during operation</li>
283
+ </ul>
284
+
285
+ <h3>Error Handling</h3>
286
+ <p>If the folder path is invalid, contains no images, or an image cannot be read, the node will display a warning in the debug panel and update its status accordingly.</p>
287
+
288
+ <h3>Performance</h3>
289
+ <p>Image loading is performed asynchronously using Sharp for optimal performance. Each image is loaded on demand, so memory usage remains low even with large folders.</p>
290
+
291
+ <h3>Tips</h3>
292
+ <ul>
293
+ <li>Use relative paths for portability across systems</li>
294
+ <li>Images are emitted in alphabetical order by filename</li>
295
+ <li>Connect to transform nodes (resize, crop, etc.) for automated batch processing</li>
296
+ <li>Use the metadata in <code>msg._folderIn</code> to track progress or create custom workflows</li>
297
+ <li>Adjust interval based on your processing pipeline speed to avoid message queue buildup</li>
298
+ </ul>
299
+ </script>
300
+
157
301
  <script type="text/x-red" data-help-name="folder-in">
158
302
  <p>Scans a folder for image files and emits them one by one at configurable intervals. Features a toggle button to start/stop emission.</p>
159
303
 
@@ -342,5 +342,6 @@ module.exports = function(RED) {
342
342
  node.status({ fill: "grey", shape: "ring", text: "Stopped" });
343
343
  }
344
344
 
345
- RED.nodes.registerType("folder-in", FolderInNode);
345
+ RED.nodes.registerType("rp-folder-in", FolderInNode);
346
+ RED.nodes.registerType("folder-in", FolderInNode); // legacy compat
346
347
  };
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('image-in', {
2
+ var _rpNodeCfg = {
3
3
  category: 'RP Image',
4
4
  color: '#A6C8A6',
5
5
  defaults: {
@@ -65,7 +65,39 @@
65
65
  // Initialize visibility
66
66
  updateDebugWidthVisibility();
67
67
  }
68
- });
68
+ };
69
+ RED.nodes.registerType('rp-image-in', _rpNodeCfg);
70
+ RED.nodes.registerType('image-in', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
71
+ </script>
72
+
73
+ <script type="text/x-red" data-template-name="rp-image-in">
74
+ <div class="form-row">
75
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
76
+ <input type="text" id="node-input-name" placeholder="Name">
77
+ </div>
78
+ <div class="form-row">
79
+ <label for="node-input-filePath"><i class="fa fa-folder-open"></i> File Path</label>
80
+ <input type="text" id="node-input-filePath" style="width: 70%;" placeholder="/path/to/your/image.jpg">
81
+ <input type="hidden" id="node-input-filePathType">
82
+ </div>
83
+ <hr>
84
+ <div class="form-row">
85
+ <label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output to</label>
86
+ <input type="text" id="node-input-outputPath" style="width: 70%;">
87
+ <input type="hidden" id="node-input-outputPathType">
88
+ </div>
89
+
90
+ <!-- Debug Configuration -->
91
+ <div class="form-row">
92
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
93
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
94
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show loaded image</label>
95
+ </div>
96
+ <div class="form-row" id="debug-width-row" style="display: none;">
97
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
98
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
99
+ <input type="hidden" id="node-input-debugWidthType">
100
+ </div>
69
101
  </script>
70
102
 
71
103
  <script type="text/x-red" data-template-name="image-in">
@@ -98,6 +130,53 @@
98
130
  </div>
99
131
  </script>
100
132
 
133
+ <script type="text/x-red" data-help-name="rp-image-in">
134
+ <p>Loads an image file from the filesystem and outputs it as a raw image object for processing in the Node-RED flow.</p>
135
+
136
+ <h3>Details</h3>
137
+ <p>This node reads image files from disk and converts them into the standard image format used throughout the Rosepetal Image Tools. It supports various image formats including JPEG, PNG, WebP, and BMP. The image is decoded using a high-performance C++ backend with OpenCV.</p>
138
+
139
+ <h3>Properties</h3>
140
+ <dl class="message-properties">
141
+ <dt>File Path <span class="property-type">string | msg | flow | global</span></dt>
142
+ <dd>The path to the image file on the server filesystem. Can be a static string (absolute or relative path) or dynamically resolved from message properties, flow context, or global context. Supports common image formats: JPEG, PNG, WebP, BMP.</dd>
143
+ <dt>Output to <span class="property-type">string</span></dt>
144
+ <dd>The location where the resulting image object will be stored. You can select between <code>msg</code>, <code>flow</code>, or <code>global</code> context. Defaults to <code>msg.payload</code>.</dd>
145
+ </dl>
146
+
147
+ <h3>Inputs</h3>
148
+ <dl class="message-properties">
149
+ <dt>payload <span class="property-type">any</span></dt>
150
+ <dd>Input message (content is ignored, only triggers the node operation).</dd>
151
+ </dl>
152
+
153
+ <h3>Outputs</h3>
154
+ <p>The node sets the property specified in 'Output to' with the processed image object using the standard format:</p>
155
+ <pre>{
156
+ data: Buffer, // Raw pixel data
157
+ width: number, // Image width in pixels
158
+ height: number, // Image height in pixels
159
+ channels: number, // Channel count (1, 3, 4)
160
+ colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
161
+ dtype: string // "uint8", "uint16", "float32"
162
+ }</pre>
163
+
164
+ <h3>Examples</h3>
165
+ <ul>
166
+ <li><strong>Static Path:</strong> Set File Path to <code>/path/to/image.jpg</code> (string type) and Output to <code>msg.payload</code></li>
167
+ <li><strong>Dynamic Path from Message:</strong> Set File Path from <code>msg.imagePath</code> to load different images based on message content</li>
168
+ <li><strong>Flow Context Path:</strong> Set File Path from <code>flow.currentImageFile</code> to use a path stored in flow context</li>
169
+ <li><strong>Multiple Images:</strong> Connect to an array-out node to work with image collections</li>
170
+ <li><strong>Processing Pipeline:</strong> Connect to transform nodes like resize, rotate, or crop for image manipulation</li>
171
+ </ul>
172
+
173
+ <h3>Error Handling</h3>
174
+ <p>If the file path is invalid or the image cannot be read, the node will display a warning and not propagate the message. Check the debug panel for specific error details.</p>
175
+
176
+ <h3>Performance</h3>
177
+ <p>Image loading is performed asynchronously using the C++ backend for optimal performance. The node status displays processing time information.</p>
178
+ </script>
179
+
101
180
  <script type="text/x-red" data-help-name="image-in">
102
181
  <p>Loads an image file from the filesystem and outputs it as a raw image object for processing in the Node-RED flow.</p>
103
182
 
@@ -147,5 +147,6 @@ module.exports = function(RED) {
147
147
  }
148
148
  });
149
149
  }
150
- RED.nodes.registerType("image-in", ImageInNode);
150
+ RED.nodes.registerType("rp-image-in", ImageInNode);
151
+ RED.nodes.registerType("image-in", ImageInNode); // legacy compat
151
152
  };
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('image-out', {
2
+ var _rpNodeCfg = {
3
3
  category: 'RP Image',
4
4
  color: '#A6C8A6',
5
5
  defaults: {
@@ -39,7 +39,7 @@
39
39
  visible: function() { return true; },
40
40
  onclick: function() {
41
41
  var node = this;
42
- var label = RED.utils.sanitize(this.name || "image-out");
42
+ var label = RED.utils.sanitize(this.name || "rp-image-out");
43
43
  var desiredState = node.active;
44
44
 
45
45
  sendToggleRequest(node, desiredState, function() {
@@ -184,7 +184,9 @@
184
184
  // Initialize debug image display
185
185
  initDebugImageDisplay();
186
186
  }
187
- });
187
+ };
188
+ RED.nodes.registerType('rp-image-out', _rpNodeCfg);
189
+ RED.nodes.registerType('image-out', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
188
190
 
189
191
  function sendToggleRequest(node, active, onSuccess, onError) {
190
192
  $.ajax({
@@ -313,6 +315,120 @@
313
315
  }
314
316
  </script>
315
317
 
318
+ <script type="text/x-red" data-template-name="rp-image-out">
319
+ <div class="form-row">
320
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
321
+ <input type="text" id="node-input-name" placeholder="Name">
322
+ </div>
323
+
324
+ <hr>
325
+
326
+ <!-- Folder Configuration -->
327
+ <div class="form-row">
328
+ <label for="node-input-folderPath"><i class="fa fa-folder"></i> Folder Path</label>
329
+ <input type="text" id="node-input-folderPath" style="width: 70%;" placeholder="/path/to/save/folder">
330
+ <input type="hidden" id="node-input-folderPathType">
331
+ </div>
332
+
333
+ <div class="form-row">
334
+ <label for="node-input-filenamePrefix"><i class="fa fa-tag"></i> Filename Prefix</label>
335
+ <input type="text" id="node-input-filenamePrefix" style="width: 70%;" placeholder="image (optional)">
336
+ <input type="hidden" id="node-input-filenamePrefixType">
337
+ <div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
338
+ Pattern: [prefix]_YYYYMMDD_HHMMSS.[ext]
339
+ </div>
340
+ </div>
341
+
342
+ <div class="form-row">
343
+ <label for="node-input-filenameFull"><i class="fa fa-file-text-o"></i> Full Filename</label>
344
+ <input type="text" id="node-input-filenameFull" style="width: 70%;" placeholder="photo_${payload.id}.jpg (optional)">
345
+ <input type="hidden" id="node-input-filenameFullType">
346
+ <div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
347
+ Overrides prefix & timestamp when provided. Leave blank for automatic naming.
348
+ </div>
349
+ </div>
350
+
351
+ <hr>
352
+
353
+ <!-- Input Configuration -->
354
+ <div class="form-row">
355
+ <label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
356
+ <input type="text" id="node-input-inputPath" style="width: 70%;">
357
+ <input type="hidden" id="node-input-inputPathType">
358
+ </div>
359
+
360
+ <hr>
361
+
362
+ <!-- Output Format Configuration -->
363
+ <div class="form-row">
364
+ <label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
365
+ <select id="node-input-outputFormat" style="width: 200px;">
366
+ <option value="jpg">JPEG</option>
367
+ <option value="png">PNG</option>
368
+ <option value="webp">WebP</option>
369
+ </select>
370
+ </div>
371
+
372
+ <div class="form-row" id="quality-row">
373
+ <label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
374
+ <input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
375
+ <span style="margin-left: 10px; color: #666;">1-100 (JPEG/WebP only)</span>
376
+ </div>
377
+
378
+ <div class="form-row" id="png-optimize-row" style="display: none;">
379
+ <label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
380
+ <input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
381
+ <label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
382
+ </div>
383
+
384
+ <div class="form-row" id="webp-lossless-row" style="display: none;">
385
+ <label for="node-input-webpLossless"><i class="fa fa-lock"></i> WebP Lossless</label>
386
+ <input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
387
+ <label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
388
+ </div>
389
+
390
+ <div class="form-row" id="webp-smartsubsample-row" style="display: none;">
391
+ <label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> WebP Smart Subsample</label>
392
+ <input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
393
+ <label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Improve chroma downsampling (lossy WebP only)</label>
394
+ </div>
395
+
396
+ <div class="form-row" id="webp-effort-row" style="display: none;">
397
+ <label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> WebP Effort</label>
398
+ <input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
399
+ <span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
400
+ </div>
401
+
402
+ <hr>
403
+
404
+ <!-- Protection Settings -->
405
+ <div class="form-row">
406
+ <label for="node-input-overwriteProtection"><i class="fa fa-shield"></i> Protection</label>
407
+ <input type="checkbox" id="node-input-overwriteProtection" style="display:inline-block; width:auto; vertical-align:baseline;" checked>
408
+ <label for="node-input-overwriteProtection" style="width:auto; margin-left:5px;">Prevent overwriting existing files (_2, _3, etc.)</label>
409
+ </div>
410
+
411
+ <div class="form-row">
412
+ <label for="node-input-maxImages"><i class="fa fa-list-ol"></i> Max Images</label>
413
+ <input type="text" id="node-input-maxImages" style="width: 120px;" placeholder="0">
414
+ <input type="hidden" id="node-input-maxImagesType">
415
+ <span style="margin-left: 10px; color: #666;">0 or blank keeps all files.</span>
416
+ </div>
417
+
418
+ <!-- Debug Configuration -->
419
+ <div class="form-row">
420
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
421
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
422
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show saved image preview</label>
423
+ </div>
424
+
425
+ <div class="form-row" id="debug-width-row" style="display: none;">
426
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
427
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
428
+ <input type="hidden" id="node-input-debugWidthType">
429
+ </div>
430
+ </script>
431
+
316
432
  <script type="text/x-red" data-template-name="image-out">
317
433
  <div class="form-row">
318
434
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -427,6 +543,84 @@
427
543
  </div>
428
544
  </script>
429
545
 
546
+ <script type="text/x-red" data-help-name="rp-image-out">
547
+ <p>Saves images to the filesystem with automatic timestamp-based naming and optional overwrite protection.</p>
548
+
549
+ <h3>Details</h3>
550
+ <p>This node saves image data to disk with automatic timestamp naming to ensure unique filenames. It includes an enable/disable button (similar to the debug node) that allows you to control whether images are saved without modifying your flow.</p>
551
+
552
+ <h3>Properties</h3>
553
+ <dl class="message-properties">
554
+ <dt>Folder Path <span class="property-type">string | msg | flow | global</span></dt>
555
+ <dd>The directory where images will be saved. Can be an absolute or relative path. The folder will be created if it doesn't exist. Can be dynamically set from message properties, flow context, or global context.</dd>
556
+
557
+ <dt>Filename Prefix <span class="property-type">string | msg | flow | global | JSONata</span></dt>
558
+ <dd>Optional prefix for the auto-generated filename. If not specified, defaults to <code>image</code>. The final filename pattern is: <code>[prefix]_YYYYMMDD_HHMMSS.[ext]</code>.</dd>
559
+
560
+ <dt>Full Filename <span class="property-type">string | msg | flow | global | JSONata</span></dt>
561
+ <dd>Overrides the prefix/timestamp pattern with an explicit name. Leave blank to keep automatic naming. You can include JSONata expressions or dynamic properties. If the expression supplies an extension (jpg/png/webp), the output format adjusts accordingly.</dd>
562
+
563
+ <dt>Input from <span class="property-type">string</span></dt>
564
+ <dd>The location of the image data to save. Defaults to <code>msg.payload</code>. Can be set to any message property, flow variable, or global variable.</dd>
565
+
566
+ <dt>Output Format <span class="property-type">select</span></dt>
567
+ <dd>The image format to save: JPEG, PNG, or WebP.</dd>
568
+
569
+ <dt>Quality <span class="property-type">number</span></dt>
570
+ <dd>Quality setting for JPEG and WebP formats (1-100). Higher values mean better quality but larger file sizes.</dd>
571
+
572
+ <dt>WebP Lossless <span class="property-type">boolean</span></dt>
573
+ <dd>When enabled and WebP is selected, encodes using lossless WebP (ignores the lossy quality slider).</dd>
574
+
575
+ <dt>WebP Effort <span class="property-type">number</span></dt>
576
+ <dd>Optional 0-6 encoder effort when WebP is selected. Higher values are slower but can yield slightly smaller files. Leave blank to use the default.</dd>
577
+
578
+ <dt>WebP Smart Subsample <span class="property-type">boolean</span></dt>
579
+ <dd>For lossy WebP only: enables smarter chroma downsampling to reduce color artifacts (slower).</dd>
580
+
581
+ <dt>PNG Optimize <span class="property-type">boolean</span></dt>
582
+ <dd>When enabled, applies maximum compression to PNG files. This creates smaller files but takes more processing time.</dd>
583
+
584
+ <dt>Overwrite Protection <span class="property-type">boolean</span></dt>
585
+ <dd>When enabled (default), automatically appends <code>_2</code>, <code>_3</code>, etc. to filenames if a file with the same name already exists.</dd>
586
+
587
+ <dt>Max Images <span class="property-type">number | msg | flow | global | JSONata</span></dt>
588
+ <dd>Optional FIFO retention policy for the target folder. When greater than zero, the node deletes the oldest files after saving to keep at most the specified number of images.</dd>
589
+
590
+ <dt>Active Button <span class="property-type">button</span></dt>
591
+ <dd>Click the button on the node to enable/disable saving. When disabled, the node passes messages through without saving images. The state is indicated by the button color (green = active, gray = inactive).</dd>
592
+ </dl>
593
+
594
+ <h3>Inputs</h3>
595
+ <dl class="message-properties">
596
+ <dt>Image Object <span class="property-type">object</span></dt>
597
+ <dd>Standard image structure with properties: data (Buffer), width, height, channels, colorSpace, dtype.</dd>
598
+ </dl>
599
+
600
+ <h3>Outputs</h3>
601
+ <p>This node has no outputs. It is a terminal node that saves images to the filesystem.</p>
602
+
603
+ <h3>Examples</h3>
604
+ <ul>
605
+ <li><strong>Basic Save:</strong> Connect to any image processing node output to save the result with timestamp naming.</li>
606
+ <li><strong>Dynamic Folder:</strong> Set folder path from <code>msg.folder</code> to save to different locations based on message content.</li>
607
+ <li><strong>With Prefix:</strong> Use prefix "webcam" to generate files like: <code>webcam_20240109_143022.jpg</code></li>
608
+ <li><strong>Overwrite Protection:</strong> If <code>image_20240109_143022.jpg</code> exists, saves as <code>image_20240109_143022_2.jpg</code></li>
609
+ <li><strong>Conditional Saving:</strong> Use the button to enable/disable saving during development or testing.</li>
610
+ </ul>
611
+
612
+ <h3>Status Indicators</h3>
613
+ <ul>
614
+ <li><strong>Gray dot "inactive":</strong> Node is disabled via button</li>
615
+ <li><strong>Blue dot "saving...":</strong> Currently writing file to disk</li>
616
+ <li><strong>Green dot "saved: filename":</strong> Successfully saved with filename shown</li>
617
+ <li><strong>Red dot "Error":</strong> Save failed (check debug panel for details)</li>
618
+ </ul>
619
+
620
+ <h3>Performance</h3>
621
+ <p>Image encoding and file writing are performed asynchronously for optimal performance. The node status displays the save time in milliseconds.</p>
622
+ </script>
623
+
430
624
  <script type="text/x-red" data-help-name="image-out">
431
625
  <p>Saves images to the filesystem with automatic timestamp-based naming and optional overwrite protection.</p>
432
626
 
@@ -563,5 +563,6 @@ module.exports = function(RED) {
563
563
  }
564
564
  });
565
565
 
566
- RED.nodes.registerType("image-out", ImageOutNode);
566
+ RED.nodes.registerType("rp-image-out", ImageOutNode);
567
+ RED.nodes.registerType("image-out", ImageOutNode); // legacy compat
567
568
  };