@rosepetal/node-red-contrib-image-tools 1.2.2 → 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 (43) hide show
  1. package/.github/workflows/build-prebuild.yml +3 -0
  2. package/install.sh +8 -0
  3. package/node-red-contrib-image-tools/lib/node-utils.js +64 -0
  4. package/node-red-contrib-image-tools/nodes/blend/add-bbs.html +242 -3
  5. package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +10 -3
  6. package/node-red-contrib-image-tools/nodes/blend/add-mask.html +282 -4
  7. package/node-red-contrib-image-tools/nodes/blend/add-mask.js +15 -8
  8. package/node-red-contrib-image-tools/nodes/blend/add-masks.html +206 -3
  9. package/node-red-contrib-image-tools/nodes/blend/add-masks.js +10 -3
  10. package/node-red-contrib-image-tools/nodes/blend/blend.html +332 -4
  11. package/node-red-contrib-image-tools/nodes/blend/blend.js +10 -3
  12. package/node-red-contrib-image-tools/nodes/io/folder-in.html +147 -3
  13. package/node-red-contrib-image-tools/nodes/io/folder-in.js +2 -1
  14. package/node-red-contrib-image-tools/nodes/io/image-in.html +81 -2
  15. package/node-red-contrib-image-tools/nodes/io/image-in.js +2 -1
  16. package/node-red-contrib-image-tools/nodes/io/image-out.html +197 -3
  17. package/node-red-contrib-image-tools/nodes/io/image-out.js +2 -1
  18. package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +398 -3
  19. package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +11 -4
  20. package/node-red-contrib-image-tools/nodes/mix/concat.html +245 -5
  21. package/node-red-contrib-image-tools/nodes/mix/concat.js +10 -3
  22. package/node-red-contrib-image-tools/nodes/mix/mosaic.html +307 -3
  23. package/node-red-contrib-image-tools/nodes/mix/mosaic.js +10 -3
  24. package/node-red-contrib-image-tools/nodes/specialized/cropBB.html +217 -4
  25. package/node-red-contrib-image-tools/nodes/specialized/cropBB.js +11 -2
  26. package/node-red-contrib-image-tools/nodes/specialized/image-align.html +285 -4
  27. package/node-red-contrib-image-tools/nodes/specialized/image-align.js +9 -2
  28. package/node-red-contrib-image-tools/nodes/transform/color-convert.html +169 -6
  29. package/node-red-contrib-image-tools/nodes/transform/color-convert.js +11 -2
  30. package/node-red-contrib-image-tools/nodes/transform/crop.html +237 -5
  31. package/node-red-contrib-image-tools/nodes/transform/crop.js +11 -2
  32. package/node-red-contrib-image-tools/nodes/transform/draw.html +152 -3
  33. package/node-red-contrib-image-tools/nodes/transform/draw.js +10 -3
  34. package/node-red-contrib-image-tools/nodes/transform/filter.html +369 -4
  35. package/node-red-contrib-image-tools/nodes/transform/filter.js +11 -2
  36. package/node-red-contrib-image-tools/nodes/transform/padding.html +316 -5
  37. package/node-red-contrib-image-tools/nodes/transform/padding.js +11 -2
  38. package/node-red-contrib-image-tools/nodes/transform/resize.html +203 -5
  39. package/node-red-contrib-image-tools/nodes/transform/resize.js +11 -2
  40. package/node-red-contrib-image-tools/nodes/transform/rotate.html +164 -5
  41. package/node-red-contrib-image-tools/nodes/transform/rotate.js +11 -2
  42. package/package.json +71 -71
  43. package/scripts/dual-register.js +267 -0
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('filter', {
2
+ var _rpNodeCfg = {
3
3
  category: 'RP Image',
4
4
  color: '#DDA0DD',
5
5
  defaults: {
@@ -12,6 +12,9 @@
12
12
  outputFormat: { value: "raw" },
13
13
  outputQuality: { value: 90 },
14
14
  pngOptimize: { value: false },
15
+ webpLossless: { value: false },
16
+ webpSmartSubsample: { value: false },
17
+ webpEffort: { value: "" },
15
18
  // Debug configuration
16
19
  debugEnabled: { value: false },
17
20
  debugWidth: { value: 200 },
@@ -28,7 +31,7 @@
28
31
  icon: "font-awesome/fa-magic",
29
32
  label: function() {
30
33
  if (this.name) { return this.name; }
31
- return `filter`;
34
+ return 'rp-filter';
32
35
  },
33
36
  oneditprepare: function() {
34
37
  // === Standard I/O TypedInput initialization ===
@@ -106,6 +109,12 @@
106
109
  const format = $("#node-input-outputFormat").val();
107
110
  $("#quality-row").toggle(format === "jpg" || format === "webp");
108
111
  $("#png-optimize-row").toggle(format === "png");
112
+
113
+ // Show WebP advanced options only when WebP is selected
114
+ const isWebp = format === "webp";
115
+ $("#webp-lossless-row").toggle(isWebp);
116
+ $("#webp-smartsubsample-row").toggle(isWebp);
117
+ $("#webp-effort-row").toggle(isWebp);
109
118
  }
110
119
  $("#node-input-outputFormat").on("change", updateQualityVisibility);
111
120
  updateQualityVisibility(); // initial state
@@ -141,7 +150,9 @@
141
150
  $('#node-input-debugEnabled').data('debug-enabled', enabled);
142
151
  });
143
152
  }
144
- });
153
+ };
154
+ RED.nodes.registerType('rp-filter', _rpNodeCfg);
155
+ RED.nodes.registerType('filter', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
145
156
 
146
157
  // Debug image display renderer - shared across all image processing nodes
147
158
  if (!window.debugImageRendererInitialized) {
@@ -253,6 +264,109 @@
253
264
  }
254
265
  </script>
255
266
 
267
+ <script type="text/x-red" data-template-name="rp-filter">
268
+ <div class="form-row">
269
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
270
+ <input type="text" id="node-input-name" placeholder="Name">
271
+ </div>
272
+
273
+ <hr>
274
+
275
+ <!-- STANDARD I/O SECTION (same as all other nodes) -->
276
+ <div class="form-row">
277
+ <label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
278
+ <input type="text" id="node-input-inputPath" style="width: 70%;">
279
+ <input type="hidden" id="node-input-inputPathType">
280
+ </div>
281
+ <div class="form-row">
282
+ <label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output to</label>
283
+ <input type="text" id="node-input-outputPath" style="width: 70%;">
284
+ <input type="hidden" id="node-input-outputPathType">
285
+ </div>
286
+ <div class="form-row">
287
+ <label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
288
+ <select id="node-input-outputFormat" style="width: 200px;">
289
+ <option value="raw">Raw (fastest)</option>
290
+ <option value="jpg">JPEG</option>
291
+ <option value="png">PNG</option>
292
+ <option value="webp">WebP</option>
293
+ </select>
294
+ </div>
295
+ <div class="form-row" id="quality-row">
296
+ <label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
297
+ <input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
298
+ <span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
299
+ </div>
300
+ <div class="form-row" id="png-optimize-row" style="display: none;">
301
+ <label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
302
+ <input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
303
+ <label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
304
+ </div>
305
+ <div class="form-row" id="webp-lossless-row" style="display: none;">
306
+ <label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
307
+ <input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
308
+ <label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
309
+ </div>
310
+ <div class="form-row" id="webp-smartsubsample-row" style="display: none;">
311
+ <label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
312
+ <input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
313
+ <label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
314
+ </div>
315
+ <div class="form-row" id="webp-effort-row" style="display: none;">
316
+ <label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
317
+ <input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
318
+ <span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
319
+ </div>
320
+
321
+ <!-- Debug Configuration -->
322
+ <div class="form-row">
323
+ <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
324
+ <input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
325
+ <label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
326
+ </div>
327
+ <div class="form-row" id="debug-width-row" style="display: none;">
328
+ <label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
329
+ <input type="text" id="node-input-debugWidth" style="width: 120px;">
330
+ <input type="hidden" id="node-input-debugWidthType">
331
+ <span style="margin-left: 10px; color: #666;">pixels</span>
332
+ </div>
333
+
334
+ <hr>
335
+
336
+ <!-- FILTER-SPECIFIC SECTION -->
337
+ <div class="form-row">
338
+ <label for="node-input-filterType"><i class="fa fa-magic"></i> Filter Type</label>
339
+ <select id="node-input-filterType" style="width: 70%;">
340
+ <option value="blur">Blur</option>
341
+ <option value="sharpen">Sharpening</option>
342
+ <option value="edge">Edge Detection</option>
343
+ <option value="emboss">Emboss</option>
344
+ <option value="gaussian">Gaussian Blur</option>
345
+ </select>
346
+ </div>
347
+
348
+ <div class="form-row" id="kernel-size-row">
349
+ <label for="node-input-kernelSize"><i class="fa fa-th"></i> Kernel Size</label>
350
+ <input type="text" id="node-input-kernelSize" style="width: 70%;" placeholder="3, 5, 7, 9, 11, 13, 15">
351
+ <input type="hidden" id="node-input-kernelSizeType">
352
+ </div>
353
+
354
+ <div class="form-row" id="intensity-row">
355
+ <label for="node-input-intensity" id="intensity-label"><i class="fa fa-sliders"></i> Intensity</label>
356
+ <input type="text" id="node-input-intensity" style="width: 70%;" placeholder="0.0 - 2.0">
357
+ <input type="hidden" id="node-input-intensityType">
358
+ </div>
359
+
360
+ <div class="form-tips">
361
+ <b>Tips:</b>
362
+ <ul>
363
+ <li><b>Kernel Size:</b> Must be odd (3, 5, 7, etc.). Larger sizes create stronger effects.</li>
364
+ <li><b>Intensity:</b> 0.0 = no effect, 1.0 = normal, 2.0 = maximum effect.</li>
365
+ <li>All parameters support dynamic values from <code>msg</code>, <code>flow</code>, or <code>global</code> context.</li>
366
+ </ul>
367
+ </div>
368
+ </script>
369
+
256
370
  <script type="text/x-red" data-template-name="filter">
257
371
  <div class="form-row">
258
372
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -291,7 +405,22 @@
291
405
  <input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
292
406
  <label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
293
407
  </div>
294
-
408
+ <div class="form-row" id="webp-lossless-row" style="display: none;">
409
+ <label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
410
+ <input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
411
+ <label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
412
+ </div>
413
+ <div class="form-row" id="webp-smartsubsample-row" style="display: none;">
414
+ <label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
415
+ <input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
416
+ <label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
417
+ </div>
418
+ <div class="form-row" id="webp-effort-row" style="display: none;">
419
+ <label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
420
+ <input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
421
+ <span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
422
+ </div>
423
+
295
424
  <!-- Debug Configuration -->
296
425
  <div class="form-row">
297
426
  <label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
@@ -341,6 +470,242 @@
341
470
  </div>
342
471
  </script>
343
472
 
473
+ <script type="text/x-red" data-help-name="rp-filter">
474
+ <p>The <strong>filter</strong> node applies professional image processing kernels including blur, sharpening, edge detection, emboss, and Gaussian blur effects. It provides configurable parameters and supports both single images and arrays with high-performance C++ backend processing using OpenCV.</p>
475
+
476
+ <h3>Details</h3>
477
+ <p>This node implements various convolution-based image processing operations with precise parameter control. Each filter type uses optimized OpenCV algorithms for maximum performance while maintaining image quality. The node supports dynamic parameter adjustment and multiple output formats, making it suitable for both real-time processing and batch operations.</p>
478
+
479
+ <h3>Properties</h3>
480
+ <dl class="message-properties">
481
+ <dt>Name <span class="property-type">string</span></dt>
482
+ <dd>Optional display name for the node</dd>
483
+
484
+ <dt>Input from <span class="property-type">msg | flow | global</span></dt>
485
+ <dd>Source path for image data (default: <code>msg.payload</code>)</dd>
486
+
487
+ <dt>Output to <span class="property-type">msg | flow | global</span></dt>
488
+ <dd>Destination path for processed image (default: <code>msg.payload</code>)</dd>
489
+
490
+ <dt>Output Format <span class="property-type">string</span></dt>
491
+ <dd>Image output format: <code>raw</code>, <code>jpg</code>, <code>png</code>, or <code>webp</code></dd>
492
+
493
+ <dt>Quality <span class="property-type">number</span></dt>
494
+ <dd>Compression quality 1-100 for JPEG and WebP formats</dd>
495
+
496
+ <dt>Filter Type <span class="property-type">string</span></dt>
497
+ <dd>Processing algorithm: <code>blur</code>, <code>sharpen</code>, <code>edge</code>, <code>emboss</code>, or <code>gaussian</code></dd>
498
+
499
+ <dt>Kernel Size <span class="property-type">number | msg | flow | global</span></dt>
500
+ <dd>Convolution kernel size (3, 5, 7, 9, 11, 13, 15). Must be odd numbers</dd>
501
+
502
+ <dt>Intensity <span class="property-type">number | msg | flow | global</span></dt>
503
+ <dd>Effect strength (0.0-2.0). 0.0=no effect, 1.0=normal, 2.0=maximum</dd>
504
+ </dl>
505
+
506
+ <h3>Inputs</h3>
507
+ <dl class="message-properties">
508
+ <dt>payload <span class="property-type">object | array</span></dt>
509
+ <dd>Image object(s) in standard format:
510
+ <pre>{
511
+ data: Buffer, // Raw pixel data or file buffer
512
+ width: number, // Image width in pixels
513
+ height: number, // Image height in pixels
514
+ channels: number, // Channel count (1, 3, 4)
515
+ colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
516
+ dtype: string // "uint8", "uint16", "float32"
517
+ }</pre>
518
+ </dd>
519
+ <dt>filter parameters <span class="property-type">number</span></dt>
520
+ <dd>When parameters use dynamic sources, values are read from specified paths</dd>
521
+ </dl>
522
+
523
+ <h3>Outputs</h3>
524
+ <dl class="message-properties">
525
+ <dt>payload <span class="property-type">object | array | Buffer</span></dt>
526
+ <dd>Processed image(s) with filter applied. Format depends on Output Format setting</dd>
527
+
528
+ <dt>Raw format output</dt>
529
+ <dd>Image object with processed pixel data:
530
+ <pre>{
531
+ data: Buffer, // Filtered image data
532
+ width: number, // Unchanged from input
533
+ height: number, // Unchanged from input
534
+ channels: number, // Unchanged from input
535
+ colorSpace: string, // Unchanged from input
536
+ dtype: string // Unchanged from input
537
+ }</pre>
538
+ </dd>
539
+
540
+ <dt>Encoded format output</dt>
541
+ <dd>Compressed image buffer (JPEG/PNG/WebP) ready for storage or transmission</dd>
542
+ </dl>
543
+
544
+ <h3>Filter Types</h3>
545
+ <h4>Blur</h4>
546
+ <ul>
547
+ <li><strong>Algorithm:</strong> Box blur convolution for uniform smoothing</li>
548
+ <li><strong>Use Cases:</strong> Noise reduction, motion blur simulation, general smoothing</li>
549
+ <li><strong>Kernel Size:</strong> 3-15 (larger = more blur)</li>
550
+ <li><strong>Intensity:</strong> 0.0-2.0 (controls blur strength)</li>
551
+ </ul>
552
+
553
+ <h4>Sharpening</h4>
554
+ <ul>
555
+ <li><strong>Algorithm:</strong> Unsharp mask technique to enhance edges and details</li>
556
+ <li><strong>Use Cases:</strong> Photo enhancement, detail restoration, edge enhancement</li>
557
+ <li><strong>Kernel Size:</strong> 3-15 (affects sharpening area)</li>
558
+ <li><strong>Intensity:</strong> 0.0-2.0 (controls sharpening strength)</li>
559
+ </ul>
560
+
561
+ <h4>Edge Detection</h4>
562
+ <ul>
563
+ <li><strong>Algorithm:</strong> Sobel operator for gradient-based edge detection</li>
564
+ <li><strong>Use Cases:</strong> Object detection, boundary identification, preprocessing for analysis</li>
565
+ <li><strong>Kernel Size:</strong> 3-15 (affects edge sensitivity)</li>
566
+ <li><strong>Intensity:</strong> 0.0-2.0 (controls edge prominence)</li>
567
+ </ul>
568
+
569
+ <h4>Emboss</h4>
570
+ <ul>
571
+ <li><strong>Algorithm:</strong> Directional convolution creating 3D embossed appearance</li>
572
+ <li><strong>Use Cases:</strong> Artistic effects, texture enhancement, relief mapping</li>
573
+ <li><strong>Kernel Size:</strong> Fixed 3x3 (parameter hidden in UI)</li>
574
+ <li><strong>Intensity:</strong> 0.0-2.0 (controls emboss depth)</li>
575
+ </ul>
576
+
577
+ <h4>Gaussian Blur</h4>
578
+ <ul>
579
+ <li><strong>Algorithm:</strong> Gaussian distribution-based blur for natural smoothing</li>
580
+ <li><strong>Use Cases:</strong> Background blur, depth of field effects, anti-aliasing</li>
581
+ <li><strong>Kernel Size:</strong> 3-15 (affects blur radius)</li>
582
+ <li><strong>Intensity:</strong> 0.0-2.0 (controls sigma value)</li>
583
+ </ul>
584
+
585
+ <h3>Parameter Behavior</h3>
586
+ <h4>Kernel Size Constraints</h4>
587
+ <ul>
588
+ <li><strong>Valid Values:</strong> 3, 5, 7, 9, 11, 13, 15 (odd numbers only)</li>
589
+ <li><strong>Automatic Correction:</strong> Even numbers rounded to nearest odd</li>
590
+ <li><strong>Range Limits:</strong> Values <3 set to 3, values >15 set to 15</li>
591
+ <li><strong>Performance Impact:</strong> Larger kernels require more computation</li>
592
+ </ul>
593
+
594
+ <h4>Intensity Scaling</h4>
595
+ <ul>
596
+ <li><strong>Range:</strong> 0.0 (no effect) to 2.0 (maximum effect)</li>
597
+ <li><strong>Default:</strong> 1.0 (standard effect strength)</li>
598
+ <li><strong>Clamping:</strong> Values <0.0 set to 0.0, values >2.0 set to 2.0</li>
599
+ <li><strong>Linear Scaling:</strong> Effect strength scales linearly with intensity</li>
600
+ </ul>
601
+
602
+ <h4>Dynamic Parameters</h4>
603
+ <ul>
604
+ <li><strong>Runtime Updates:</strong> Parameters can be modified per message</li>
605
+ <li><strong>Type Validation:</strong> Non-numeric values trigger warnings</li>
606
+ <li><strong>Missing Values:</strong> Use node configuration defaults</li>
607
+ <li><strong>Array Processing:</strong> Same parameters applied to all images in array</li>
608
+ </ul>
609
+
610
+ <h3>Examples</h3>
611
+ <h4>Photo Enhancement</h4>
612
+ <pre>// Sharpen a photo with moderate strength
613
+ {
614
+ filterType: "sharpen",
615
+ kernelSize: 5,
616
+ intensity: 1.2
617
+ }</pre>
618
+
619
+ <h4>Background Blur</h4>
620
+ <pre>// Create shallow depth of field effect
621
+ {
622
+ filterType: "gaussian",
623
+ kernelSize: 9,
624
+ intensity: 1.5
625
+ }</pre>
626
+
627
+ <h4>Edge Detection</h4>
628
+ <pre>// Detect edges for computer vision preprocessing
629
+ {
630
+ filterType: "edge",
631
+ kernelSize: 3,
632
+ intensity: 1.0
633
+ }</pre>
634
+
635
+ <h4>Dynamic Filter Selection</h4>
636
+ <pre>// Use message properties for adaptive filtering
637
+ msg.filterIntensity = 0.8;
638
+ msg.blurAmount = 7;
639
+ // Configure node: intensity from msg.filterIntensity, kernelSize from msg.blurAmount</pre>
640
+
641
+ <h4>Artistic Effects</h4>
642
+ <pre>// Create embossed relief effect
643
+ {
644
+ filterType: "emboss",
645
+ intensity: 1.8
646
+ }</pre>
647
+
648
+ <h3>Node Interactions</h3>
649
+ <h4>Pre-Processing Chain</h4>
650
+ <ul>
651
+ <li><strong>image-in → resize → filter:</strong> Scale then apply effects</li>
652
+ <li><strong>crop → filter → padding:</strong> Extract region, apply effect, add border</li>
653
+ <li><strong>array-select → filter:</strong> Apply effects to selected images</li>
654
+ </ul>
655
+
656
+ <h4>Post-Processing Chain</h4>
657
+ <ul>
658
+ <li><strong>filter → filter:</strong> Stack multiple effects (e.g., blur then sharpen)</li>
659
+ <li><strong>filter → concat:</strong> Apply effects then combine images</li>
660
+ <li><strong>filter → array-out:</strong> Process then encode for output</li>
661
+ </ul>
662
+
663
+ <h4>Common Workflows</h4>
664
+ <ul>
665
+ <li><strong>Photo Processing:</strong> resize → filter (sharpen) → array-out</li>
666
+ <li><strong>Computer Vision:</strong> filter (edge) → analysis processing</li>
667
+ <li><strong>Creative Effects:</strong> filter (emboss) → filter (blur) → mosaic</li>
668
+ <li><strong>Noise Reduction:</strong> filter (gaussian) → filter (sharpen) → output</li>
669
+ </ul>
670
+
671
+ <h3>Output Formats</h3>
672
+ <dl class="message-properties">
673
+ <dt>raw <span class="property-type">object</span></dt>
674
+ <dd>Fastest option. Returns processed image object for further Node-RED processing</dd>
675
+
676
+ <dt>jpg <span class="property-type">Buffer</span></dt>
677
+ <dd>JPEG-compressed buffer with configurable quality (1-100). Good for photographs</dd>
678
+
679
+ <dt>png <span class="property-type">Buffer</span></dt>
680
+ <dd>PNG-compressed buffer with lossless compression. Preserves fine details from filtering</dd>
681
+
682
+ <dt>webp <span class="property-type">Buffer</span></dt>
683
+ <dd>WebP-compressed buffer with configurable quality. Modern format with excellent compression</dd>
684
+ </dl>
685
+
686
+ <h3>Error Handling</h3>
687
+ <ul>
688
+ <li><strong>Invalid Input:</strong> Non-image objects trigger warnings and prevent processing</li>
689
+ <li><strong>Parameter Validation:</strong> Invalid kernel sizes or intensities are corrected with warnings</li>
690
+ <li><strong>Missing Properties:</strong> Incomplete image objects are rejected with detailed error messages</li>
691
+ <li><strong>Unsupported Formats:</strong> Incompatible image data types trigger conversion attempts</li>
692
+ <li><strong>Memory Limits:</strong> Large images with large kernels may fail with memory errors</li>
693
+ <li><strong>Dynamic Values:</strong> Missing or invalid dynamic values fall back to node defaults</li>
694
+ </ul>
695
+
696
+ <h3>Performance</h3>
697
+ <ul>
698
+ <li><strong>C++ Backend:</strong> Optimized OpenCV algorithms for maximum performance</li>
699
+ <li><strong>Array Support:</strong> Parallel processing of image arrays using Promise.all()</li>
700
+ <li><strong>Memory Efficiency:</strong> In-place processing where possible to minimize memory usage</li>
701
+ <li><strong>Status Display:</strong> Real-time timing information (conversion, processing, encoding)</li>
702
+ <li><strong>Algorithm Optimization:</strong> SIMD instructions and multi-threading where supported</li>
703
+ <li><strong>Performance Metrics:</strong> Processing speed varies by filter: blur/gaussian ~1ms/MP, edge/emboss ~2ms/MP</li>
704
+ </ul>
705
+
706
+ <p><strong>Note:</strong> The node status bar displays detailed timing information: conversion time (input processing) + task time (filtering operation) + encoding time (output formatting). Filter performance varies significantly based on kernel size and image complexity.</p>
707
+ </script>
708
+
344
709
  <script type="text/x-red" data-help-name="filter">
345
710
  <p>The <strong>filter</strong> node applies professional image processing kernels including blur, sharpening, edge detection, emboss, and Gaussian blur effects. It provides configurable parameters and supports both single images and arrays with high-performance C++ backend processing using OpenCV.</p>
346
711
 
@@ -45,6 +45,8 @@ module.exports = function (RED) {
45
45
  const outputFormat = config.outputFormat || 'raw';
46
46
  const outputQuality = parseInt(config.outputQuality) || 90;
47
47
  const pngOptimize = config.pngOptimize || false;
48
+ const useSharpWebp = outputFormat === 'webp' && NodeUtils.hasAdvancedWebpOptions(config);
49
+ const cppFormat = useSharpWebp ? 'raw' : outputFormat;
48
50
 
49
51
  // Filter parameters
50
52
  const filterType = config.filterType || 'blur';
@@ -97,7 +99,7 @@ module.exports = function (RED) {
97
99
  filterType,
98
100
  kernelSize,
99
101
  intensity,
100
- outputFormat,
102
+ cppFormat,
101
103
  outputQuality,
102
104
  pngOptimize
103
105
  );
@@ -118,6 +120,12 @@ module.exports = function (RED) {
118
120
  { totalConvertMs: 0, totalTaskMs: 0, encodeMs: 0, images: [] }
119
121
  );
120
122
 
123
+ if (useSharpWebp) {
124
+ for (let i = 0; i < images.length; i++) {
125
+ images[i] = await NodeUtils.encodeWebpAdvanced(images[i], config);
126
+ }
127
+ }
128
+
121
129
  // Prepare output
122
130
  const output = Array.isArray(originalPayload) ? images : images[0];
123
131
 
@@ -192,5 +200,6 @@ module.exports = function (RED) {
192
200
  });
193
201
  }
194
202
 
195
- RED.nodes.registerType('filter', FilterNode);
203
+ RED.nodes.registerType('rp-filter', FilterNode);
204
+ RED.nodes.registerType('filter', FilterNode); // legacy compat
196
205
  };