@rosepetal/node-red-contrib-image-tools 1.2.3 → 1.3.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.
Files changed (43) hide show
  1. package/.github/workflows/build-prebuild.yml +3 -0
  2. package/install.sh +14 -6
  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 -45
  42. package/scripts/dual-register.js +297 -0
  43. package/node-red-contrib-image-tools/package.json +0 -58
@@ -1,6 +1,6 @@
1
1
  <!-- 1 ▸ Runtime registration ------------------------------------------------>
2
2
  <script type="text/javascript">
3
- RED.nodes.registerType('padding', {
3
+ var _rpNodeCfg = {
4
4
  category : 'RP Image',
5
5
  color : '#DDA0DD',
6
6
  icon : 'font-awesome/fa-square-o',
@@ -31,7 +31,7 @@
31
31
  padColor:{value:"#000000"}
32
32
  },
33
33
  inputs:1, outputs:1,
34
- label:function(){ return this.name || "padding"; },
34
+ label:function(){ return this.name || "rp-padding"; },
35
35
 
36
36
  oneditprepare:function(){
37
37
  /* I/O path typed‑inputs */
@@ -98,7 +98,9 @@
98
98
  $('#node-input-debugEnabled').data('debug-enabled', enabled);
99
99
  });
100
100
  }
101
- });
101
+ };
102
+ RED.nodes.registerType('rp-padding', _rpNodeCfg);
103
+ RED.nodes.registerType('padding', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
102
104
 
103
105
  // Debug image display renderer - shared across all image processing nodes
104
106
  if (!window.debugImageRendererInitialized) {
@@ -211,7 +213,103 @@
211
213
  </script>
212
214
 
213
215
  <!-- 2 ▸ Edit‑dialog template ------------------------------------------------>
214
- <script type="text/x-red" data-template-name="padding">
216
+ <script type="text/x-red" data-template-name="rp-padding">
217
+ <div class="form-row">
218
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
219
+ <input type="text" id="node-input-name">
220
+ </div>
221
+
222
+ <hr>
223
+
224
+ <div class="form-row">
225
+ <label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input</label>
226
+ <input type="text" id="node-input-inputPath" style="width:70%;">
227
+ <input type="hidden" id="node-input-inputPathType">
228
+ </div>
229
+ <div class="form-row">
230
+ <label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output</label>
231
+ <input type="text" id="node-input-outputPath" style="width:70%;">
232
+ <input type="hidden" id="node-input-outputPathType">
233
+ </div>
234
+ <div class="form-row">
235
+ <label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
236
+ <select id="node-input-outputFormat" style="width: 200px;">
237
+ <option value="raw">Raw (fastest)</option>
238
+ <option value="jpg">JPEG</option>
239
+ <option value="png">PNG</option>
240
+ <option value="webp">WebP</option>
241
+ </select>
242
+ </div>
243
+ <div class="form-row" id="quality-row">
244
+ <label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
245
+ <input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
246
+ <span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
247
+ </div>
248
+ <div class="form-row" id="png-optimize-row" style="display: none;">
249
+ <label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
250
+ <input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
251
+ <label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
252
+ </div>
253
+ <div class="form-row" id="webp-lossless-row" style="display: none;">
254
+ <label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
255
+ <input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
256
+ <label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
257
+ </div>
258
+ <div class="form-row" id="webp-smartsubsample-row" style="display: none;">
259
+ <label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
260
+ <input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
261
+ <label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
262
+ </div>
263
+ <div class="form-row" id="webp-effort-row" style="display: none;">
264
+ <label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
265
+ <input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
266
+ <span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
267
+ </div>
268
+
269
+ <!-- Debug Configuration -->
270
+ <div class="form-row">
271
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
272
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
273
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
274
+ </div>
275
+ <div class="form-row" id="debug-width-row" style="display: none;">
276
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
277
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
278
+ <input type="hidden" id="node-input-debugWidthType">
279
+ <span style="margin-left: 10px; color: #666;">pixels</span>
280
+ </div>
281
+
282
+ <hr>
283
+
284
+ <strong>Margins (pixels)</strong>
285
+ <div class="form-row">
286
+ <label>Top</label>
287
+ <input type="text" id="node-input-top" style="width:65%;">
288
+ <input type="hidden" id="node-input-topType">
289
+ </div>
290
+ <div class="form-row">
291
+ <label>Bottom</label>
292
+ <input type="text" id="node-input-bottom" style="width:65%;">
293
+ <input type="hidden" id="node-input-bottomType">
294
+ </div>
295
+ <div class="form-row">
296
+ <label>Left</label>
297
+ <input type="text" id="node-input-left" style="width:65%;">
298
+ <input type="hidden" id="node-input-leftType">
299
+ </div>
300
+ <div class="form-row">
301
+ <label>Right</label>
302
+ <input type="text" id="node-input-right" style="width:65%;">
303
+ <input type="hidden" id="node-input-rightType">
304
+ </div>
305
+
306
+ <div class="form-row">
307
+ <label for="node-input-padColor"><i class="fa fa-tint"></i> Colour</label>
308
+ <input type="color" id="node-input-padColor" style="width:80px;">
309
+ </div>
310
+ </script>
311
+
312
+ <script type="text/x-red" data-template-name="padding">
215
313
  <div class="form-row">
216
314
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
217
315
  <input type="text" id="node-input-name">
@@ -308,7 +406,196 @@
308
406
  </script>
309
407
 
310
408
  <!-- 3 ▸ Help panel --------------------------------------------------------->
311
- <script type="text/x-red" data-help-name="padding">
409
+ <script type="text/x-red" data-help-name="rp-padding">
410
+ <p>The <strong>padding</strong> node adds solid color borders around images with pixel-perfect precision. It supports independent margin control for each side and works with both single images and arrays, using high-performance C++ backend processing with OpenCV.</p>
411
+
412
+ <h3>Details</h3>
413
+ <p>This node extends images by adding colored pixels around their edges, effectively increasing the canvas size. The padding operation preserves the original image content while adding configurable margins on all sides. The node maintains the original image's color space and data type while seamlessly integrating the padding color.</p>
414
+
415
+ <h3>Properties</h3>
416
+ <dl class="message-properties">
417
+ <dt>Name <span class="property-type">string</span></dt>
418
+ <dd>Optional display name for the node</dd>
419
+
420
+ <dt>Input from <span class="property-type">msg | flow | global</span></dt>
421
+ <dd>Source path for image data (default: <code>msg.payload</code>)</dd>
422
+
423
+ <dt>Output to <span class="property-type">msg | flow | global</span></dt>
424
+ <dd>Destination path for processed image (default: <code>msg.payload</code>)</dd>
425
+
426
+ <dt>Output Format <span class="property-type">string</span></dt>
427
+ <dd>Image output format: <code>raw</code>, <code>jpg</code>, <code>png</code>, or <code>webp</code></dd>
428
+
429
+ <dt>Quality <span class="property-type">number</span></dt>
430
+ <dd>Compression quality 1-100 for JPEG and WebP formats</dd>
431
+
432
+ <dt>Top <span class="property-type">number | msg | flow | global</span></dt>
433
+ <dd>Pixels to add above the image (default: 0)</dd>
434
+
435
+ <dt>Bottom <span class="property-type">number | msg | flow | global</span></dt>
436
+ <dd>Pixels to add below the image (default: 0)</dd>
437
+
438
+ <dt>Left <span class="property-type">number | msg | flow | global</span></dt>
439
+ <dd>Pixels to add to the left of the image (default: 0)</dd>
440
+
441
+ <dt>Right <span class="property-type">number | msg | flow | global</span></dt>
442
+ <dd>Pixels to add to the right of the image (default: 0)</dd>
443
+
444
+ <dt>Colour <span class="property-type">color</span></dt>
445
+ <dd>Hex color code for padding areas (default: #000000)</dd>
446
+ </dl>
447
+
448
+ <h3>Inputs</h3>
449
+ <dl class="message-properties">
450
+ <dt>payload <span class="property-type">object | array</span></dt>
451
+ <dd>Image object(s) in standard format:
452
+ <pre>{
453
+ data: Buffer, // Raw pixel data or file buffer
454
+ width: number, // Image width in pixels
455
+ height: number, // Image height in pixels
456
+ channels: number, // Channel count (1, 3, 4)
457
+ colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
458
+ dtype: string // "uint8", "uint16", "float32"
459
+ }</pre>
460
+ </dd>
461
+ <dt>margin values <span class="property-type">number</span></dt>
462
+ <dd>When margin parameters use dynamic sources, values are read from specified paths</dd>
463
+ </dl>
464
+
465
+ <h3>Outputs</h3>
466
+ <dl class="message-properties">
467
+ <dt>payload <span class="property-type">object | array | Buffer</span></dt>
468
+ <dd>Processed image(s) with padding applied. Format depends on Output Format setting</dd>
469
+
470
+ <dt>Raw format output</dt>
471
+ <dd>Image object with updated dimensions:
472
+ <pre>{
473
+ data: Buffer, // Padded image data
474
+ width: number, // Original width + left + right
475
+ height: number, // Original height + top + bottom
476
+ channels: number, // Unchanged from input
477
+ colorSpace: string, // Unchanged from input
478
+ dtype: string // Unchanged from input
479
+ }</pre>
480
+ </dd>
481
+
482
+ <dt>Encoded format output</dt>
483
+ <dd>Compressed image buffer (JPEG/PNG/WebP) ready for storage or transmission</dd>
484
+ </dl>
485
+
486
+ <h3>Padding Behavior</h3>
487
+ <h4>Dimension Calculation</h4>
488
+ <ul>
489
+ <li><strong>New Width:</strong> original_width + left + right</li>
490
+ <li><strong>New Height:</strong> original_height + top + bottom</li>
491
+ <li><strong>Minimum Values:</strong> All margin values must be ≥ 0</li>
492
+ <li><strong>Zero Padding:</strong> When all margins are 0, returns original image unchanged</li>
493
+ </ul>
494
+
495
+ <h4>Color Handling</h4>
496
+ <ul>
497
+ <li><strong>Color Format:</strong> Input as hex color (#RRGGBB)</li>
498
+ <li><strong>Channel Mapping:</strong> Automatically converts to image's color space</li>
499
+ <li><strong>Grayscale Images:</strong> Uses luminance value of selected color</li>
500
+ <li><strong>Alpha Channels:</strong> Padding areas receive full opacity (255)</li>
501
+ </ul>
502
+
503
+ <h4>Data Type Preservation</h4>
504
+ <ul>
505
+ <li><strong>uint8:</strong> Color values scaled to 0-255 range</li>
506
+ <li><strong>uint16:</strong> Color values scaled to 0-65535 range</li>
507
+ <li><strong>float32:</strong> Color values normalized to 0.0-1.0 range</li>
508
+ </ul>
509
+
510
+ <h3>Examples</h3>
511
+ <h4>Basic Uniform Padding</h4>
512
+ <pre>// Add 10 pixels of black padding on all sides
513
+ {
514
+ top: 10, bottom: 10, left: 10, right: 10,
515
+ padColor: "#000000"
516
+ }</pre>
517
+
518
+ <h4>Asymmetric Padding</h4>
519
+ <pre>// Create letterbox effect with white top/bottom bars
520
+ {
521
+ top: 50, bottom: 50, left: 0, right: 0,
522
+ padColor: "#FFFFFF"
523
+ }</pre>
524
+
525
+ <h4>Dynamic Margins</h4>
526
+ <pre>// Use message properties for responsive padding
527
+ msg.topPadding = 20;
528
+ msg.sidePadding = 15;
529
+ // Configure node: top from msg.topPadding, left/right from msg.sidePadding</pre>
530
+
531
+ <h4>Colorful Borders</h4>
532
+ <pre>// Add colored border for visual emphasis
533
+ {
534
+ top: 5, bottom: 5, left: 5, right: 5,
535
+ padColor: "#FF0000" // Red border
536
+ }</pre>
537
+
538
+ <h3>Node Interactions</h3>
539
+ <h4>Pre-Processing Chain</h4>
540
+ <ul>
541
+ <li><strong>image-in → crop → padding:</strong> Crop then add border</li>
542
+ <li><strong>array-select → padding:</strong> Add padding to selected images</li>
543
+ <li><strong>filter → padding:</strong> Apply effects then add border frame</li>
544
+ </ul>
545
+
546
+ <h4>Post-Processing Chain</h4>
547
+ <ul>
548
+ <li><strong>padding → resize:</strong> Add padding then scale to final size</li>
549
+ <li><strong>padding → concat:</strong> Pad images before combining</li>
550
+ <li><strong>padding → array-out:</strong> Apply borders then encode for output</li>
551
+ </ul>
552
+
553
+ <h4>Common Workflows</h4>
554
+ <ul>
555
+ <li><strong>Thumbnail Generation:</strong> resize → padding → array-out (consistent dimensions)</li>
556
+ <li><strong>Gallery Layout:</strong> padding → concat → mosaic (spaced grid layout)</li>
557
+ <li><strong>Frame Creation:</strong> padding → filter → padding (nested border effects)</li>
558
+ </ul>
559
+
560
+ <h3>Output Formats</h3>
561
+ <dl class="message-properties">
562
+ <dt>raw <span class="property-type">object</span></dt>
563
+ <dd>Fastest option. Returns processed image object for further Node-RED processing</dd>
564
+
565
+ <dt>jpg <span class="property-type">Buffer</span></dt>
566
+ <dd>JPEG-compressed buffer with configurable quality (1-100). Good for photographs</dd>
567
+
568
+ <dt>png <span class="property-type">Buffer</span></dt>
569
+ <dd>PNG-compressed buffer with lossless compression. Preserves transparency</dd>
570
+
571
+ <dt>webp <span class="property-type">Buffer</span></dt>
572
+ <dd>WebP-compressed buffer with configurable quality. Modern format with excellent compression</dd>
573
+ </dl>
574
+
575
+ <h3>Error Handling</h3>
576
+ <ul>
577
+ <li><strong>Invalid Input:</strong> Non-image objects trigger warnings and prevent processing</li>
578
+ <li><strong>Negative Margins:</strong> Values < 0 are treated as 0 with warning</li>
579
+ <li><strong>Missing Properties:</strong> Incomplete image objects are rejected with detailed error messages</li>
580
+ <li><strong>Memory Limits:</strong> Very large padding operations may fail with memory errors</li>
581
+ <li><strong>Color Format:</strong> Invalid hex colors default to black (#000000)</li>
582
+ <li><strong>Dynamic Values:</strong> Missing or invalid dynamic values default to 0</li>
583
+ </ul>
584
+
585
+ <h3>Performance</h3>
586
+ <ul>
587
+ <li><strong>C++ Backend:</strong> High-performance OpenCV-based processing</li>
588
+ <li><strong>Array Support:</strong> Parallel processing of image arrays using Promise.all()</li>
589
+ <li><strong>Memory Efficiency:</strong> Optimized memory allocation for large images</li>
590
+ <li><strong>Status Display:</strong> Real-time timing information (conversion, processing, encoding)</li>
591
+ <li><strong>Zero-Copy:</strong> Minimal memory copying for efficient processing</li>
592
+ <li><strong>Performance Metrics:</strong> Typical processing: <1ms per megapixel for raw output</li>
593
+ </ul>
594
+
595
+ <p><strong>Note:</strong> The node status bar displays detailed timing information: conversion time (input processing) + task time (padding operation) + encoding time (output formatting).</p>
596
+ </script>
597
+
598
+ <script type="text/x-red" data-help-name="padding">
312
599
  <p>The <strong>padding</strong> node adds solid color borders around images with pixel-perfect precision. It supports independent margin control for each side and works with both single images and arrays, using high-performance C++ backend processing with OpenCV.</p>
313
600
 
314
601
  <h3>Details</h3>
@@ -167,5 +167,6 @@ module.exports = function (RED) {
167
167
  });
168
168
  }
169
169
 
170
- RED.nodes.registerType('padding', PaddingNode);
170
+ RED.nodes.registerType('rp-padding', PaddingNode);
171
+ RED.nodes.registerType('padding', PaddingNode); // legacy compat
171
172
  };
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('resize', {
2
+ var _rpNodeCfg = {
3
3
  category: 'RP Image',
4
4
  color: '#DDA0DD',
5
5
  defaults: {
@@ -33,7 +33,7 @@
33
33
  icon: "font-awesome/fa-arrows-alt",
34
34
  label: function() {
35
35
  if (this.name) { return this.name; }
36
- return `resize`;
36
+ return 'rp-resize';
37
37
  },
38
38
  oneditprepare: function() {
39
39
  // === Inicialización de los Widgets "TypedInput" ===
@@ -155,7 +155,9 @@
155
155
  $('#node-input-debugEnabled').data('debug-enabled', enabled);
156
156
  });
157
157
  }
158
- });
158
+ };
159
+ RED.nodes.registerType('rp-resize', _rpNodeCfg);
160
+ RED.nodes.registerType('resize', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
159
161
 
160
162
  // Debug image display renderer - shared across all image processing nodes
161
163
  if (!window.debugImageRendererInitialized) {
@@ -280,6 +282,103 @@
280
282
  }
281
283
  </script>
282
284
 
285
+ <script type="text/x-red" data-template-name="rp-resize">
286
+ <div class="form-row">
287
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
288
+ <input type="text" id="node-input-name" placeholder="Name">
289
+ </div>
290
+
291
+ <hr>
292
+
293
+ <div class="form-row">
294
+ <label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
295
+ <input type="text" id="node-input-inputPath" style="width: 70%;">
296
+ <input type="hidden" id="node-input-inputPathType">
297
+ </div>
298
+ <div class="form-row">
299
+ <label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output to</label>
300
+ <input type="text" id="node-input-outputPath" style="width: 70%;">
301
+ <input type="hidden" id="node-input-outputPathType">
302
+
303
+ </div>
304
+ <div class="form-row">
305
+ <label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
306
+ <select id="node-input-outputFormat" style="width: 200px;">
307
+ <option value="raw">Raw (fastest)</option>
308
+ <option value="jpg">JPEG</option>
309
+ <option value="png">PNG</option>
310
+ <option value="webp">WebP</option>
311
+ </select>
312
+ </div>
313
+ <div class="form-row" id="quality-row">
314
+ <label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
315
+ <input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
316
+ <span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
317
+ </div>
318
+ <div class="form-row" id="png-optimize-row" style="display: none;">
319
+ <label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
320
+ <input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
321
+ <label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
322
+ </div>
323
+ <div class="form-row" id="webp-lossless-row" style="display: none;">
324
+ <label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
325
+ <input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
326
+ <label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
327
+ </div>
328
+ <div class="form-row" id="webp-smartsubsample-row" style="display: none;">
329
+ <label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
330
+ <input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
331
+ <label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
332
+ </div>
333
+ <div class="form-row" id="webp-effort-row" style="display: none;">
334
+ <label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
335
+ <input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
336
+ <span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
337
+ </div>
338
+
339
+ <!-- Debug Configuration -->
340
+ <div class="form-row">
341
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
342
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
343
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
344
+ </div>
345
+ <div class="form-row" id="debug-width-row" style="display: none;">
346
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
347
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
348
+ <input type="hidden" id="node-input-debugWidthType">
349
+ <span style="margin-left: 10px; color: #666;">pixels</span>
350
+ </div>
351
+
352
+ <hr>
353
+
354
+ <div class="form-row">
355
+ <label><i class="fa fa-arrows-h"></i> Width</label>
356
+ <div style="display: flex; align-items: center; width: 70%;">
357
+ <select id="node-input-widthMode" style="width: 120px; margin-right: 5px;">
358
+ <option value="set">Set to</option>
359
+ <option value="multiply">Multiply by</option>
360
+ </select>
361
+ <input type="text" id="node-input-widthValue" style="flex-grow: 1;">
362
+ <input type="hidden" id="node-input-widthType">
363
+ </div>
364
+ </div>
365
+ <div class="form-row">
366
+ <label><i class="fa fa-arrows-v"></i> Height</label>
367
+ <div style="display: flex; align-items: center; width: 70%;">
368
+ <select id="node-input-heightMode" style="width: 120px; margin-right: 5px;">
369
+ <option value="set">Set to</option>
370
+ <option value="multiply">Multiply by</option>
371
+ </select>
372
+ <input type="text" id="node-input-heightValue" style="flex-grow: 1;">
373
+ <input type="hidden" id="node-input-heightType">
374
+ </div>
375
+ </div>
376
+
377
+ <div class="form-tips">
378
+ <b>Tip:</b> If a dimension value is left empty, it will be set to 'Auto' to maintain the original aspect ratio.
379
+ </div>
380
+ </script>
381
+
283
382
  <script type="text/x-red" data-template-name="resize">
284
383
  <div class="form-row">
285
384
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -377,6 +476,81 @@
377
476
  </div>
378
477
  </script>
379
478
 
479
+ <script type="text/x-red" data-help-name="rp-resize">
480
+ <p>Resizes images to specified dimensions using high-performance C++ processing with OpenCV backend.</p>
481
+
482
+ <h3>Details</h3>
483
+ <p>This node provides flexible image resizing capabilities with multiple operation modes and dynamic value sources. It supports both single images and arrays, with automatic aspect ratio preservation when one dimension is omitted. All processing is performed asynchronously using the optimized C++ backend.</p>
484
+
485
+ <h3>Properties</h3>
486
+ <dl class="message-properties">
487
+ <dt>Input from <span class="property-type">string</span></dt>
488
+ <dd>The location to read image data from. You can select between <code>msg</code>, <code>flow</code>, or <code>global</code> context. Defaults to <code>msg.payload</code>.</dd>
489
+ <dt>Output to <span class="property-type">string</span></dt>
490
+ <dd>The location where the resized image 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>
491
+ <dt>Output Format <span class="property-type">string</span></dt>
492
+ <dd>Choose output format: <code>raw</code> (fastest, standard image object), <code>jpg</code>, <code>png</code>, or <code>webp</code> (encoded file buffers).</dd>
493
+ <dt>Quality <span class="property-type">number</span></dt>
494
+ <dd>Compression quality for JPEG and WebP formats (1-100). Only visible when jpg or webp format is selected. Default: 90.</dd>
495
+ <dt>Width Mode <span class="property-type">string</span></dt>
496
+ <dd>Width operation: <code>Set to</code> (fixed pixel value) or <code>Multiply by</code> (scale factor).</dd>
497
+ <dt>Width Value <span class="property-type">number|string</span></dt>
498
+ <dd>Width value from number, msg property, flow, or global context. Leave empty for automatic aspect ratio preservation.</dd>
499
+ <dt>Height Mode <span class="property-type">string</span></dt>
500
+ <dd>Height operation: <code>Set to</code> (fixed pixel value) or <code>Multiply by</code> (scale factor).</dd>
501
+ <dt>Height Value <span class="property-type">number|string</span></dt>
502
+ <dd>Height value from number, msg property, flow, or global context. Leave empty for automatic aspect ratio preservation.</dd>
503
+ </dl>
504
+
505
+ <h3>Inputs</h3>
506
+ <dl class="message-properties">
507
+ <dt>payload <span class="property-type">object | array</span></dt>
508
+ <dd>Single image object or array of image objects in standard format: <code>{ data: Buffer, width: number, height: number, channels: number, colorSpace: string, dtype: string }</code></dd>
509
+ </dl>
510
+
511
+ <h3>Outputs</h3>
512
+ <dl class="message-properties">
513
+ <dt>payload <span class="property-type">object | array | Buffer</span></dt>
514
+ <dd>Resized image(s). Format depends on Output Format setting: raw image object(s) or encoded file buffer(s).</dd>
515
+ </dl>
516
+
517
+ <h3>Dimension Configuration</h3>
518
+ <p><strong>Operation Modes:</strong></p>
519
+ <ul>
520
+ <li><strong>Set to:</strong> Resizes the dimension to a fixed pixel value (e.g., 800 pixels)</li>
521
+ <li><strong>Multiply by:</strong> Multiplies the original dimension by a factor (e.g., 0.5 for half size, 2.0 for double size)</li>
522
+ </ul>
523
+ <p><strong>Value Sources:</strong> Values can come from fixed numbers, message properties, flow context, or global context using the TypedInput dropdowns.</p>
524
+ <p><strong>Aspect Ratio:</strong> If either width or height is left empty, it will be calculated automatically to maintain the original aspect ratio.</p>
525
+
526
+ <h3>Examples</h3>
527
+ <ul>
528
+ <li><strong>Fixed Size:</strong> Width: Set to 800, Height: Set to 600 → All images resized to 800x600</li>
529
+ <li><strong>Proportional:</strong> Width: Set to 800, Height: (empty) → Width set to 800, height calculated proportionally</li>
530
+ <li><strong>Scale Factor:</strong> Width: Multiply by 0.5, Height: Multiply by 0.5 → Images scaled to half size</li>
531
+ <li><strong>Dynamic Values:</strong> Width: Set to msg.targetWidth → Use width value from message property</li>
532
+ </ul>
533
+
534
+ <h3>Node Interactions</h3>
535
+ <p><strong>Input Sources:</strong> Image-in, Array-out, other transform nodes</p>
536
+ <p><strong>Output Destinations:</strong> Other transform nodes, Mix nodes (concat, mosaic), Array-in for collections</p>
537
+ <p><strong>Common Workflows:</strong> Image-in → Resize → other transforms, Array processing → Resize → Array-select</p>
538
+
539
+ <h3>Output Formats</h3>
540
+ <ul>
541
+ <li><strong>Raw:</strong> Standard image object (fastest, for further processing)</li>
542
+ <li><strong>JPEG:</strong> Compressed file buffer with quality setting</li>
543
+ <li><strong>PNG:</strong> Lossless compressed file buffer</li>
544
+ <li><strong>WebP:</strong> Modern compressed format with quality setting</li>
545
+ </ul>
546
+
547
+ <h3>Error Handling</h3>
548
+ <p>The node validates input data and dimensions, displaying warnings for invalid inputs. Processing errors are logged and the message is not propagated.</p>
549
+
550
+ <h3>Performance</h3>
551
+ <p>Uses optimized C++ backend with OpenCV for high-performance processing. Node status displays processing time. Array inputs are processed in parallel for optimal performance.</p>
552
+ </script>
553
+
380
554
  <script type="text/x-red" data-help-name="resize">
381
555
  <p>Resizes images to specified dimensions using high-performance C++ processing with OpenCV backend.</p>
382
556
 
@@ -191,5 +191,6 @@ module.exports = function (RED) {
191
191
  });
192
192
  }
193
193
 
194
- RED.nodes.registerType('resize', ResizeNode);
194
+ RED.nodes.registerType('rp-resize', ResizeNode);
195
+ RED.nodes.registerType('resize', ResizeNode); // legacy compat
195
196
  };