@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.
- package/.github/workflows/build-prebuild.yml +3 -0
- package/install.sh +14 -6
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.html +219 -3
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +2 -1
- package/node-red-contrib-image-tools/nodes/blend/add-mask.html +258 -3
- package/node-red-contrib-image-tools/nodes/blend/add-mask.js +2 -1
- package/node-red-contrib-image-tools/nodes/blend/add-masks.html +183 -3
- package/node-red-contrib-image-tools/nodes/blend/add-masks.js +2 -1
- package/node-red-contrib-image-tools/nodes/blend/blend.html +308 -3
- package/node-red-contrib-image-tools/nodes/blend/blend.js +2 -1
- package/node-red-contrib-image-tools/nodes/io/folder-in.html +147 -3
- package/node-red-contrib-image-tools/nodes/io/folder-in.js +2 -1
- package/node-red-contrib-image-tools/nodes/io/image-in.html +81 -2
- package/node-red-contrib-image-tools/nodes/io/image-in.js +2 -1
- package/node-red-contrib-image-tools/nodes/io/image-out.html +197 -3
- package/node-red-contrib-image-tools/nodes/io/image-out.js +2 -1
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +375 -3
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +2 -1
- package/node-red-contrib-image-tools/nodes/mix/concat.html +222 -5
- package/node-red-contrib-image-tools/nodes/mix/concat.js +2 -1
- package/node-red-contrib-image-tools/nodes/mix/mosaic.html +284 -3
- package/node-red-contrib-image-tools/nodes/mix/mosaic.js +2 -1
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.html +193 -3
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.js +2 -1
- package/node-red-contrib-image-tools/nodes/specialized/image-align.html +260 -2
- package/node-red-contrib-image-tools/nodes/specialized/image-align.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/color-convert.html +144 -5
- package/node-red-contrib-image-tools/nodes/transform/color-convert.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/crop.html +213 -5
- package/node-red-contrib-image-tools/nodes/transform/crop.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/draw.html +128 -3
- package/node-red-contrib-image-tools/nodes/transform/draw.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/filter.html +344 -3
- package/node-red-contrib-image-tools/nodes/transform/filter.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/padding.html +292 -5
- package/node-red-contrib-image-tools/nodes/transform/padding.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/resize.html +177 -3
- package/node-red-contrib-image-tools/nodes/transform/resize.js +2 -1
- package/node-red-contrib-image-tools/nodes/transform/rotate.html +140 -5
- package/node-red-contrib-image-tools/nodes/transform/rotate.js +2 -1
- package/package.json +71 -45
- package/scripts/dual-register.js +297 -0
- package/node-red-contrib-image-tools/package.json +0 -58
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- nodes/rosepetal-concat/concat.html -->
|
|
2
2
|
|
|
3
3
|
<script type="text/javascript">
|
|
4
|
-
|
|
4
|
+
var _rpNodeCfg = {
|
|
5
5
|
category:'RP Image',
|
|
6
6
|
color:'#DDA0DD',
|
|
7
7
|
icon:'font-awesome/fa-th-large',
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
padColor :{value:"#000000"}
|
|
25
25
|
},
|
|
26
26
|
inputs:1,outputs:1,
|
|
27
|
-
label:function(){return this.name||"concat";},
|
|
27
|
+
label:function(){return this.name||"rp-concat";},
|
|
28
28
|
oneditprepare:function(){
|
|
29
29
|
/* path typedInputs */
|
|
30
30
|
$("#node-input-inputPath").typedInput({
|
|
@@ -85,7 +85,9 @@
|
|
|
85
85
|
$('#node-input-debugEnabled').data('debug-enabled', enabled);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
}
|
|
88
|
+
};
|
|
89
|
+
RED.nodes.registerType('rp-concat', _rpNodeCfg);
|
|
90
|
+
RED.nodes.registerType('concat', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
|
|
89
91
|
|
|
90
92
|
// Debug image display renderer - shared across all image processing nodes
|
|
91
93
|
if (!window.debugImageRendererInitialized) {
|
|
@@ -197,7 +199,7 @@
|
|
|
197
199
|
}
|
|
198
200
|
</script>
|
|
199
201
|
|
|
200
|
-
<script type="text/x-red" data-template-name="concat">
|
|
202
|
+
<script type="text/x-red" data-template-name="rp-concat">
|
|
201
203
|
<div class="form-row">
|
|
202
204
|
<label><i class="fa fa-sign-in"></i> Input</label>
|
|
203
205
|
<input type="text" id="node-input-inputPath" style="width:70%;">
|
|
@@ -282,7 +284,222 @@
|
|
|
282
284
|
</div>
|
|
283
285
|
</script>
|
|
284
286
|
|
|
285
|
-
|
|
287
|
+
<script type="text/x-red" data-template-name="concat">
|
|
288
|
+
<div class="form-row">
|
|
289
|
+
<label><i class="fa fa-sign-in"></i> Input</label>
|
|
290
|
+
<input type="text" id="node-input-inputPath" style="width:70%;">
|
|
291
|
+
<input type="hidden" id="node-input-inputPathType">
|
|
292
|
+
</div>
|
|
293
|
+
<div class="form-row">
|
|
294
|
+
<label><i class="fa fa-sign-out"></i> Output</label>
|
|
295
|
+
<input type="text" id="node-input-outputPath" style="width:70%;">
|
|
296
|
+
<input type="hidden" id="node-input-outputPathType">
|
|
297
|
+
</div>
|
|
298
|
+
<div class="form-row">
|
|
299
|
+
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
300
|
+
<select id="node-input-outputFormat" style="width: 200px;">
|
|
301
|
+
<option value="raw">Raw (fastest)</option>
|
|
302
|
+
<option value="jpg">JPEG</option>
|
|
303
|
+
<option value="png">PNG</option>
|
|
304
|
+
<option value="webp">WebP</option>
|
|
305
|
+
</select>
|
|
306
|
+
</div>
|
|
307
|
+
<div class="form-row" id="quality-row">
|
|
308
|
+
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
309
|
+
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
310
|
+
<span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
|
|
311
|
+
</div>
|
|
312
|
+
<div class="form-row" id="png-optimize-row" style="display: none;">
|
|
313
|
+
<label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
|
|
314
|
+
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
315
|
+
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
316
|
+
</div>
|
|
317
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
318
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
319
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
320
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
321
|
+
</div>
|
|
322
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
323
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
324
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
325
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
328
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
329
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
330
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<!-- Debug Configuration -->
|
|
334
|
+
<div class="form-row">
|
|
335
|
+
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
336
|
+
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
337
|
+
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
|
|
338
|
+
</div>
|
|
339
|
+
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
340
|
+
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
341
|
+
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
342
|
+
<input type="hidden" id="node-input-debugWidthType">
|
|
343
|
+
<span style="margin-left: 10px; color: #666;">pixels</span>
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<hr/>
|
|
347
|
+
<div class="form-row">
|
|
348
|
+
<label><i class="fa fa-arrows-h"></i> Direction</label>
|
|
349
|
+
<select id="node-input-direction">
|
|
350
|
+
<option value="right">→ Right</option>
|
|
351
|
+
<option value="left">← Left</option>
|
|
352
|
+
<option value="down">↓ Down</option>
|
|
353
|
+
<option value="up">↑ Up</option>
|
|
354
|
+
</select>
|
|
355
|
+
</div>
|
|
356
|
+
<div class="form-row">
|
|
357
|
+
<label><i class="fa fa-th"></i> Strategy</label>
|
|
358
|
+
<select id="node-input-strategy">
|
|
359
|
+
<option value="pad-start">Pad at start</option>
|
|
360
|
+
<option value="pad-end">Pad at end</option>
|
|
361
|
+
<option value="pad-both">Pad both sides</option>
|
|
362
|
+
<option value="resize">Resize to max</option>
|
|
363
|
+
</select>
|
|
364
|
+
</div>
|
|
365
|
+
<!-- único cambio: id para poder toggle‑ar -->
|
|
366
|
+
<div class="form-row" id="pad-colour-row">
|
|
367
|
+
<label for="node-input-padColor"><i class="fa fa-tint"></i> Pad colour</label>
|
|
368
|
+
<input type="color" id="node-input-padColor" style="width:80px;">
|
|
369
|
+
</div>
|
|
370
|
+
</script>
|
|
371
|
+
|
|
372
|
+
<script type="text/x-red" data-help-name="rp-concat">
|
|
373
|
+
<p><b>rosepetal-concat</b> combines multiple images into a single composite image through concatenation. Images can be joined horizontally or vertically with intelligent handling of size differences using padding or scaling strategies.</p>
|
|
374
|
+
|
|
375
|
+
<h3>Details</h3>
|
|
376
|
+
<p>This node processes arrays of images and combines them into a seamless composite using high-performance C++ operations. It supports flexible concatenation directions, intelligent sizing strategies, and maintains image quality throughout the process. The node handles both raw pixel data and encoded image files transparently.</p>
|
|
377
|
+
|
|
378
|
+
<h3>Properties</h3>
|
|
379
|
+
<dl class="message-properties">
|
|
380
|
+
<dt>Input from <span class="property-type">string</span></dt>
|
|
381
|
+
<dd>Message property path containing the input image array. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
382
|
+
|
|
383
|
+
<dt>Output to <span class="property-type">string</span></dt>
|
|
384
|
+
<dd>Message property path where the concatenated image will be stored. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
385
|
+
|
|
386
|
+
<dt>Output Format <span class="property-type">string</span></dt>
|
|
387
|
+
<dd>Format for the output image: <code>raw</code> (fastest), <code>jpg</code>, <code>png</code>, or <code>webp</code>.</dd>
|
|
388
|
+
|
|
389
|
+
<dt>Quality <span class="property-type">number</span></dt>
|
|
390
|
+
<dd>Compression quality (1-100) for JPEG and WebP formats. Only visible when JPG or WebP is selected.</dd>
|
|
391
|
+
|
|
392
|
+
<dt>Direction <span class="property-type">string</span></dt>
|
|
393
|
+
<dd>Concatenation direction: <code>right</code> (→), <code>left</code> (←), <code>down</code> (↓), or <code>up</code> (↑).</dd>
|
|
394
|
+
|
|
395
|
+
<dt>Strategy <span class="property-type">string</span></dt>
|
|
396
|
+
<dd>Size handling strategy: <code>pad-start</code>, <code>pad-end</code>, <code>pad-both</code>, or <code>resize</code>.</dd>
|
|
397
|
+
|
|
398
|
+
<dt>Pad Colour <span class="property-type">color</span></dt>
|
|
399
|
+
<dd>Background color for padding areas when using pad strategies. Hidden when resize strategy is selected.</dd>
|
|
400
|
+
</dl>
|
|
401
|
+
|
|
402
|
+
<h3>Inputs</h3>
|
|
403
|
+
<p>The input should be an array of image objects in the standard format:</p>
|
|
404
|
+
<pre>{
|
|
405
|
+
data: Buffer, // Raw pixel data or encoded file buffer
|
|
406
|
+
width: number, // Image width in pixels
|
|
407
|
+
height: number, // Image height in pixels
|
|
408
|
+
channels: number, // Channel count (1=grayscale, 3=RGB, 4=RGBA)
|
|
409
|
+
colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
|
|
410
|
+
dtype: string // "uint8", "uint16", "float32"
|
|
411
|
+
}</pre>
|
|
412
|
+
<p>File buffers (JPEG, PNG, WebP, BMP) are automatically detected and decoded.</p>
|
|
413
|
+
|
|
414
|
+
<h3>Outputs</h3>
|
|
415
|
+
<p>Produces a single concatenated image in the specified format:</p>
|
|
416
|
+
<ul>
|
|
417
|
+
<li><b>Raw format:</b> Complete image object with pixel data and metadata</li>
|
|
418
|
+
<li><b>Encoded formats (JPG/PNG/WebP):</b> File buffer ready for storage or transmission</li>
|
|
419
|
+
</ul>
|
|
420
|
+
<p>Output dimensions depend on input images and concatenation direction. Width/height are calculated automatically based on the combined images.</p>
|
|
421
|
+
|
|
422
|
+
<h3>Concatenation Strategies</h3>
|
|
423
|
+
<h4>Padding Strategies</h4>
|
|
424
|
+
<ul>
|
|
425
|
+
<li><b>Pad Start:</b> Adds padding before smaller images (top for horizontal, left for vertical)</li>
|
|
426
|
+
<li><b>Pad End:</b> Adds padding after smaller images (bottom for horizontal, right for vertical)</li>
|
|
427
|
+
<li><b>Pad Both:</b> Centers smaller images with equal padding on both sides</li>
|
|
428
|
+
</ul>
|
|
429
|
+
<h4>Resize Strategy</h4>
|
|
430
|
+
<ul>
|
|
431
|
+
<li><b>Resize:</b> Scales all images to match the largest dimension, eliminating gaps entirely</li>
|
|
432
|
+
</ul>
|
|
433
|
+
|
|
434
|
+
<h3>Direction Behavior</h3>
|
|
435
|
+
<ul>
|
|
436
|
+
<li><b>Right (→):</b> Images placed left-to-right, heights normalized</li>
|
|
437
|
+
<li><b>Left (←):</b> Images placed right-to-left, heights normalized</li>
|
|
438
|
+
<li><b>Down (↓):</b> Images stacked top-to-bottom, widths normalized</li>
|
|
439
|
+
<li><b>Up (↑):</b> Images stacked bottom-to-top, widths normalized</li>
|
|
440
|
+
</ul>
|
|
441
|
+
|
|
442
|
+
<h3>Examples</h3>
|
|
443
|
+
<h4>Horizontal Photo Strip</h4>
|
|
444
|
+
<p>Create a horizontal photo strip from portrait images:</p>
|
|
445
|
+
<ul>
|
|
446
|
+
<li>Direction: Right (→)</li>
|
|
447
|
+
<li>Strategy: Pad Both</li>
|
|
448
|
+
<li>Pad Color: White (#FFFFFF)</li>
|
|
449
|
+
</ul>
|
|
450
|
+
|
|
451
|
+
<h4>Vertical Timeline</h4>
|
|
452
|
+
<p>Stack images vertically for a timeline view:</p>
|
|
453
|
+
<ul>
|
|
454
|
+
<li>Direction: Down (↓)</li>
|
|
455
|
+
<li>Strategy: Resize</li>
|
|
456
|
+
<li>Output: PNG for high quality</li>
|
|
457
|
+
</ul>
|
|
458
|
+
|
|
459
|
+
<h4>Dynamic Context Usage</h4>
|
|
460
|
+
<p>Use flow context for batch processing multiple image sets:</p>
|
|
461
|
+
<ul>
|
|
462
|
+
<li>Input from: flow.imageArray</li>
|
|
463
|
+
<li>Output to: flow.concatenated</li>
|
|
464
|
+
</ul>
|
|
465
|
+
|
|
466
|
+
<h3>Node Interactions</h3>
|
|
467
|
+
<ul>
|
|
468
|
+
<li><b>Upstream:</b> Works with <code>array-in</code>, <code>image-in</code>, or any nodes producing image arrays</li>
|
|
469
|
+
<li><b>Downstream:</b> Connect to <code>array-out</code>, file writers, or further processing nodes</li>
|
|
470
|
+
<li><b>Chaining:</b> Can be chained with other mix nodes for complex compositions</li>
|
|
471
|
+
<li><b>Flow Integration:</b> Supports flow and global context for cross-node data sharing</li>
|
|
472
|
+
</ul>
|
|
473
|
+
|
|
474
|
+
<h3>Output Formats</h3>
|
|
475
|
+
<ul>
|
|
476
|
+
<li><b>Raw (fastest):</b> Uncompressed pixel data, ideal for further processing</li>
|
|
477
|
+
<li><b>JPEG:</b> Lossy compression, smaller files, quality parameter controls compression level</li>
|
|
478
|
+
<li><b>PNG:</b> Lossless compression, preserves transparency, larger files</li>
|
|
479
|
+
<li><b>WebP:</b> Modern format with superior compression, quality parameter available</li>
|
|
480
|
+
</ul>
|
|
481
|
+
|
|
482
|
+
<h3>Error Handling</h3>
|
|
483
|
+
<ul>
|
|
484
|
+
<li><b>Input Validation:</b> Comprehensive validation of image structure and array format</li>
|
|
485
|
+
<li><b>Size Compatibility:</b> Automatic handling of different image dimensions</li>
|
|
486
|
+
<li><b>Memory Management:</b> Efficient memory usage with automatic cleanup</li>
|
|
487
|
+
<li><b>Format Support:</b> Graceful handling of mixed input formats</li>
|
|
488
|
+
<li><b>Warning System:</b> Uses <code>node.warn()</code> for non-fatal issues without stopping flow</li>
|
|
489
|
+
</ul>
|
|
490
|
+
|
|
491
|
+
<h3>Performance</h3>
|
|
492
|
+
<ul>
|
|
493
|
+
<li><b>C++ Backend:</b> High-performance OpenCV-based processing with optimized build flags</li>
|
|
494
|
+
<li><b>Zero-Copy Operations:</b> Minimal memory allocation and copying for maximum efficiency</li>
|
|
495
|
+
<li><b>Parallel Processing:</b> Array operations processed in parallel using Promise.all()</li>
|
|
496
|
+
<li><b>Status Timing:</b> Real-time performance metrics displayed as <code>conv | task | enc</code> (conversion, processing, encoding)</li>
|
|
497
|
+
<li><b>Memory Optimization:</b> Automatic memory management and garbage collection</li>
|
|
498
|
+
<li><b>Build Optimization:</b> Compiled with <code>-O3</code>, <code>-march=native</code>, <code>-ffast-math</code> flags</li>
|
|
499
|
+
</ul>
|
|
500
|
+
</script>
|
|
501
|
+
|
|
502
|
+
<script type="text/x-red" data-help-name="concat">
|
|
286
503
|
<p><b>rosepetal-concat</b> combines multiple images into a single composite image through concatenation. Images can be joined horizontally or vertically with intelligent handling of size differences using padding or scaling strategies.</p>
|
|
287
504
|
|
|
288
505
|
<h3>Details</h3>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- 1 ▸ Runtime registration -->
|
|
4
4
|
<script type="text/javascript">
|
|
5
|
-
|
|
5
|
+
var _rpNodeCfg = {
|
|
6
6
|
|
|
7
7
|
category:'RP Image',
|
|
8
8
|
color :'#DDA0DD',
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
|
|
34
34
|
inputs:1, outputs:1,
|
|
35
|
-
label:function(){ return this.name || "mosaic"; },
|
|
35
|
+
label:function(){ return this.name || "rp-mosaic"; },
|
|
36
36
|
|
|
37
37
|
/* ---------------- oneditprepare ---------------- */
|
|
38
38
|
oneditprepare:function(){
|
|
@@ -179,7 +179,9 @@
|
|
|
179
179
|
$('#node-input-debugEnabled').data('debug-enabled', enabled);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
};
|
|
183
|
+
RED.nodes.registerType('rp-mosaic', _rpNodeCfg);
|
|
184
|
+
RED.nodes.registerType('mosaic', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
|
|
183
185
|
|
|
184
186
|
// Debug image display renderer - shared across all image processing nodes
|
|
185
187
|
if (!window.debugImageRendererInitialized) {
|
|
@@ -292,6 +294,125 @@
|
|
|
292
294
|
</script>
|
|
293
295
|
|
|
294
296
|
<!-- 2 ▸ Edit‑dialog template -->
|
|
297
|
+
<script type="text/x-red" data-template-name="rp-mosaic">
|
|
298
|
+
|
|
299
|
+
<!-- Name -->
|
|
300
|
+
<div class="form-row">
|
|
301
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
302
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<hr>
|
|
306
|
+
|
|
307
|
+
<!-- STANDARD I/O SECTION (copied from crop.html) -->
|
|
308
|
+
<div class="form-row">
|
|
309
|
+
<label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
|
|
310
|
+
<input type="text" id="node-input-inputPath" style="width: 70%;">
|
|
311
|
+
<input type="hidden" id="node-input-inputPathType">
|
|
312
|
+
</div>
|
|
313
|
+
<div class="form-row">
|
|
314
|
+
<label for="node-input-outputPath"><i class="fa fa-sign-out"></i> Output to</label>
|
|
315
|
+
<input type="text" id="node-input-outputPath" style="width: 70%;">
|
|
316
|
+
<input type="hidden" id="node-input-outputPathType">
|
|
317
|
+
</div>
|
|
318
|
+
<div class="form-row">
|
|
319
|
+
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
320
|
+
<select id="node-input-outputFormat" style="width: 200px;">
|
|
321
|
+
<option value="raw">Raw (fastest)</option>
|
|
322
|
+
<option value="jpg">JPEG</option>
|
|
323
|
+
<option value="png">PNG</option>
|
|
324
|
+
<option value="webp">WebP</option>
|
|
325
|
+
</select>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="form-row" id="quality-row">
|
|
328
|
+
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
329
|
+
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
330
|
+
<span style="margin-left: 10px; color: #666;">1-100 (JPG/WebP only)</span>
|
|
331
|
+
</div>
|
|
332
|
+
<div class="form-row" id="png-optimize-row" style="display: none;">
|
|
333
|
+
<label for="node-input-pngOptimize"><i class="fa fa-compress"></i> PNG Optimize</label>
|
|
334
|
+
<input type="checkbox" id="node-input-pngOptimize" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
335
|
+
<label for="node-input-pngOptimize" style="width:auto; margin-left:5px;">Compress PNG (slower, smaller file)</label>
|
|
336
|
+
</div>
|
|
337
|
+
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
338
|
+
<label for="node-input-webpLossless"><i class="fa fa-lock"></i> Lossless</label>
|
|
339
|
+
<input type="checkbox" id="node-input-webpLossless" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
340
|
+
<label for="node-input-webpLossless" style="width:auto; margin-left:5px;">Encode WebP without loss</label>
|
|
341
|
+
</div>
|
|
342
|
+
<div class="form-row" id="webp-smartsubsample-row" style="display: none;">
|
|
343
|
+
<label for="node-input-webpSmartSubsample"><i class="fa fa-magic"></i> Smart Subsample</label>
|
|
344
|
+
<input type="checkbox" id="node-input-webpSmartSubsample" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
345
|
+
<label for="node-input-webpSmartSubsample" style="width:auto; margin-left:5px;">Better chroma downsampling (lossy only)</label>
|
|
346
|
+
</div>
|
|
347
|
+
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
348
|
+
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> Effort</label>
|
|
349
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
350
|
+
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<!-- Debug Configuration -->
|
|
354
|
+
<div class="form-row">
|
|
355
|
+
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
356
|
+
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
357
|
+
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show processed image</label>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
360
|
+
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
361
|
+
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
362
|
+
<input type="hidden" id="node-input-debugWidthType">
|
|
363
|
+
<span style="margin-left: 10px; color: #666;">pixels</span>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<hr>
|
|
367
|
+
|
|
368
|
+
<!-- CANVAS CONFIGURATION -->
|
|
369
|
+
<div class="form-row">
|
|
370
|
+
<label for="node-input-canvasWidth"><i class="fa fa-arrows-h"></i> Canvas Width</label>
|
|
371
|
+
<input type="text" id="node-input-canvasWidth" style="width: 70%;" placeholder="800">
|
|
372
|
+
<input type="hidden" id="node-input-canvasWidthType">
|
|
373
|
+
</div>
|
|
374
|
+
<div class="form-row">
|
|
375
|
+
<label for="node-input-canvasHeight"><i class="fa fa-arrows-v"></i> Canvas Height</label>
|
|
376
|
+
<input type="text" id="node-input-canvasHeight" style="width: 70%;" placeholder="600">
|
|
377
|
+
<input type="hidden" id="node-input-canvasHeightType">
|
|
378
|
+
</div>
|
|
379
|
+
<div class="form-row">
|
|
380
|
+
<label for="node-input-backgroundColor"><i class="fa fa-paint-brush"></i> Background Color</label>
|
|
381
|
+
<input type="color" id="node-input-backgroundColor" style="width: 70px; height: 30px;">
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div class="form-row">
|
|
385
|
+
<label for="node-input-coordNorm"><i class="fa fa-percent"></i> Normalized Coords</label>
|
|
386
|
+
<input type="checkbox" id="node-input-coordNorm" style="width: 20px; height: 20px;">
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
<!-- Tips that toggle -->
|
|
390
|
+
<div id="norm-enabled" class="form-tips" style="font-size: 0.85em; margin: 4px 0; color: #666;">
|
|
391
|
+
<b>Normalized ON:</b> position values must be between <code>0.0</code> and <code>1.0</code> (fractions of canvas dimensions).
|
|
392
|
+
</div>
|
|
393
|
+
<div id="norm-disabled" class="form-tips" style="font-size: 0.85em; margin: 4px 0; color: #666;">
|
|
394
|
+
<b>Normalized OFF:</b> position values are absolute pixels from top-left corner.
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
<hr>
|
|
398
|
+
|
|
399
|
+
<!-- POSITION MAPPING TABLE -->
|
|
400
|
+
<div class="form-row">
|
|
401
|
+
<label style="width: 100%; margin-bottom: 10px;"><i class="fa fa-th"></i> Image Positions</label>
|
|
402
|
+
<div id="position-container" style="width: 100%;"></div>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<div class="form-tips">
|
|
406
|
+
<b>Instructions:</b>
|
|
407
|
+
<ul>
|
|
408
|
+
<li><b>Array Index:</b> Which image from the input array to place (0 = first image, 1 = second, etc.)</li>
|
|
409
|
+
<li><b>X, Y Position:</b> Top-left corner coordinates on the canvas</li>
|
|
410
|
+
<li><b>Multiple Positions:</b> Same image can be placed multiple times at different positions</li>
|
|
411
|
+
<li><b>Dynamic Configuration:</b> Use Add/Remove buttons to manage position mappings</li>
|
|
412
|
+
</ul>
|
|
413
|
+
</div>
|
|
414
|
+
</script>
|
|
415
|
+
|
|
295
416
|
<script type="text/x-red" data-template-name="mosaic">
|
|
296
417
|
|
|
297
418
|
<!-- Name -->
|
|
@@ -412,6 +533,166 @@
|
|
|
412
533
|
</script>
|
|
413
534
|
|
|
414
535
|
<!-- 3 ▸ Help panel -->
|
|
536
|
+
<script type="text/x-red" data-help-name="rp-mosaic">
|
|
537
|
+
<p><b>rosepetal-mosaic</b> creates a composite image by placing multiple images from an input array onto a canvas at specified positions. This node enables precise control over image positioning, supports normalized coordinates, and offers flexible canvas configuration for creating complex image layouts.</p>
|
|
538
|
+
|
|
539
|
+
<h3>Details</h3>
|
|
540
|
+
<p>This node processes arrays of images and places them onto a customizable canvas using high-performance C++ operations. It supports both absolute pixel coordinates and normalized coordinates (0.0-1.0), dynamic canvas sizing, and flexible positioning controls. The node handles both raw pixel data and encoded image files transparently, making it ideal for creating collages, dashboards, and composite layouts.</p>
|
|
541
|
+
|
|
542
|
+
<h3>Properties</h3>
|
|
543
|
+
<dl class="message-properties">
|
|
544
|
+
<dt>Input from <span class="property-type">string</span></dt>
|
|
545
|
+
<dd>Message property path containing the input image array. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
546
|
+
|
|
547
|
+
<dt>Output to <span class="property-type">string</span></dt>
|
|
548
|
+
<dd>Message property path where the mosaic image will be stored. Supports <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
549
|
+
|
|
550
|
+
<dt>Output Format <span class="property-type">string</span></dt>
|
|
551
|
+
<dd>Format for the output image: <code>raw</code> (fastest), <code>jpg</code>, <code>png</code>, or <code>webp</code>.</dd>
|
|
552
|
+
|
|
553
|
+
<dt>Quality <span class="property-type">number</span></dt>
|
|
554
|
+
<dd>Compression quality (1-100) for JPEG and WebP formats. Only visible when JPG or WebP is selected.</dd>
|
|
555
|
+
|
|
556
|
+
<dt>Canvas Width <span class="property-type">number|string</span></dt>
|
|
557
|
+
<dd>Width of the output canvas in pixels. Supports dynamic values from <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
558
|
+
|
|
559
|
+
<dt>Canvas Height <span class="property-type">number|string</span></dt>
|
|
560
|
+
<dd>Height of the output canvas in pixels. Supports dynamic values from <code>msg</code>, <code>flow</code>, or <code>global</code> context via TypedInput.</dd>
|
|
561
|
+
|
|
562
|
+
<dt>Background Color <span class="property-type">color</span></dt>
|
|
563
|
+
<dd>Canvas background color in hex format (e.g., #000000). Images are placed on top of this background.</dd>
|
|
564
|
+
|
|
565
|
+
<dt>Normalized Coords <span class="property-type">boolean</span></dt>
|
|
566
|
+
<dd>When enabled, position coordinates use normalized values (0.0-1.0) as fractions of canvas dimensions. When disabled, coordinates are absolute pixels.</dd>
|
|
567
|
+
|
|
568
|
+
<dt>Image Positions <span class="property-type">array</span></dt>
|
|
569
|
+
<dd>Dynamic table of position mappings. Each row specifies: Array Index (which input image), X Position, Y Position. Same image can be placed multiple times.</dd>
|
|
570
|
+
</dl>
|
|
571
|
+
|
|
572
|
+
<h3>Inputs</h3>
|
|
573
|
+
<p>The input should be an array of image objects in the standard format:</p>
|
|
574
|
+
<pre>{
|
|
575
|
+
data: Buffer, // Raw pixel data or encoded file buffer
|
|
576
|
+
width: number, // Image width in pixels
|
|
577
|
+
height: number, // Image height in pixels
|
|
578
|
+
channels: number, // Channel count (1=grayscale, 3=RGB, 4=RGBA)
|
|
579
|
+
colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
|
|
580
|
+
dtype: string // "uint8", "uint16", "float32"
|
|
581
|
+
}</pre>
|
|
582
|
+
<p>File buffers (JPEG, PNG, WebP, BMP) are automatically detected and decoded.</p>
|
|
583
|
+
|
|
584
|
+
<h3>Outputs</h3>
|
|
585
|
+
<p>Produces a single composite mosaic image in the specified format:</p>
|
|
586
|
+
<ul>
|
|
587
|
+
<li><b>Raw format:</b> Complete image object with pixel data and metadata</li>
|
|
588
|
+
<li><b>Encoded formats (JPG/PNG/WebP):</b> File buffer ready for storage or transmission</li>
|
|
589
|
+
</ul>
|
|
590
|
+
<p>Output dimensions match the configured canvas size. Images are placed at their specified positions, potentially overlapping if coordinates overlap.</p>
|
|
591
|
+
|
|
592
|
+
<h3>Position Mapping System</h3>
|
|
593
|
+
<h4>Array Index</h4>
|
|
594
|
+
<ul>
|
|
595
|
+
<li><b>Zero-based indexing:</b> 0 = first image, 1 = second image, etc.</li>
|
|
596
|
+
<li><b>Multiple placement:</b> Same image can be referenced multiple times for duplication</li>
|
|
597
|
+
<li><b>Out-of-bounds handling:</b> Invalid indices are gracefully ignored with warnings</li>
|
|
598
|
+
</ul>
|
|
599
|
+
|
|
600
|
+
<h4>Coordinate Systems</h4>
|
|
601
|
+
<ul>
|
|
602
|
+
<li><b>Absolute pixels (Normalized OFF):</b> Direct pixel coordinates from top-left corner (0,0)</li>
|
|
603
|
+
<li><b>Normalized coordinates (Normalized ON):</b> Values 0.0-1.0 as fractions of canvas dimensions</li>
|
|
604
|
+
<li><b>Position reference:</b> All coordinates specify the top-left corner of placed images</li>
|
|
605
|
+
</ul>
|
|
606
|
+
|
|
607
|
+
<h4>Dynamic Configuration</h4>
|
|
608
|
+
<ul>
|
|
609
|
+
<li><b>Add/Remove buttons:</b> Dynamically manage position mappings in the editor</li>
|
|
610
|
+
<li><b>Real-time validation:</b> Invalid values are automatically corrected</li>
|
|
611
|
+
<li><b>Persistent configuration:</b> Position mappings are saved with the flow</li>
|
|
612
|
+
</ul>
|
|
613
|
+
|
|
614
|
+
<h3>Examples</h3>
|
|
615
|
+
<h4>Photo Collage</h4>
|
|
616
|
+
<p>Create a photo collage with normalized positioning:</p>
|
|
617
|
+
<ul>
|
|
618
|
+
<li>Canvas: 1200x800 pixels</li>
|
|
619
|
+
<li>Normalized Coords: ON</li>
|
|
620
|
+
<li>Positions: (0, 0.1, 0.1), (1, 0.6, 0.1), (2, 0.1, 0.6), (3, 0.6, 0.6)</li>
|
|
621
|
+
<li>Background: White (#FFFFFF)</li>
|
|
622
|
+
</ul>
|
|
623
|
+
|
|
624
|
+
<h4>Dashboard Layout</h4>
|
|
625
|
+
<p>Create a dashboard with absolute positioning:</p>
|
|
626
|
+
<ul>
|
|
627
|
+
<li>Canvas: 1920x1080 pixels</li>
|
|
628
|
+
<li>Normalized Coords: OFF</li>
|
|
629
|
+
<li>Header image at (0, 0), sidebar at (0, 100), main content at (300, 100)</li>
|
|
630
|
+
<li>Background: Dark gray (#333333)</li>
|
|
631
|
+
</ul>
|
|
632
|
+
|
|
633
|
+
<h4>Dynamic Canvas from Context</h4>
|
|
634
|
+
<p>Use flow context for dynamic sizing:</p>
|
|
635
|
+
<ul>
|
|
636
|
+
<li>Canvas Width: flow.screenWidth</li>
|
|
637
|
+
<li>Canvas Height: flow.screenHeight</li>
|
|
638
|
+
<li>Input from: flow.thumbnails</li>
|
|
639
|
+
<li>Responsive positioning based on screen dimensions</li>
|
|
640
|
+
</ul>
|
|
641
|
+
|
|
642
|
+
<h3>Mosaic Patterns</h3>
|
|
643
|
+
<h4>Grid Layouts</h4>
|
|
644
|
+
<ul>
|
|
645
|
+
<li><b>Regular Grid:</b> Use normalized coordinates with calculated spacing (e.g., 0.25, 0.5, 0.75)</li>
|
|
646
|
+
<li><b>Asymmetric Grid:</b> Mix different image sizes with custom positioning</li>
|
|
647
|
+
<li><b>Overlapping Grid:</b> Create layered effects with overlapping positions</li>
|
|
648
|
+
</ul>
|
|
649
|
+
|
|
650
|
+
<h4>Artistic Arrangements</h4>
|
|
651
|
+
<ul>
|
|
652
|
+
<li><b>Scattered Layout:</b> Random positioning for organic arrangements</li>
|
|
653
|
+
<li><b>Circular Pattern:</b> Calculate positions around a center point</li>
|
|
654
|
+
<li><b>Layered Composition:</b> Z-order determined by position mapping sequence</li>
|
|
655
|
+
</ul>
|
|
656
|
+
|
|
657
|
+
<h3>Node Interactions</h3>
|
|
658
|
+
<ul>
|
|
659
|
+
<li><b>Upstream:</b> Works with <code>array-in</code>, <code>image-in</code>, or any nodes producing image arrays</li>
|
|
660
|
+
<li><b>Downstream:</b> Connect to <code>array-out</code>, file writers, or display nodes</li>
|
|
661
|
+
<li><b>Chaining:</b> Can be combined with <code>concat</code> and other processing nodes</li>
|
|
662
|
+
<li><b>Context Integration:</b> Supports dynamic canvas sizing and positioning via context</li>
|
|
663
|
+
<li><b>Flow Coordination:</b> Use with inject nodes for automated mosaic generation</li>
|
|
664
|
+
</ul>
|
|
665
|
+
|
|
666
|
+
<h3>Output Formats</h3>
|
|
667
|
+
<ul>
|
|
668
|
+
<li><b>Raw (fastest):</b> Uncompressed pixel data, ideal for further processing or chaining</li>
|
|
669
|
+
<li><b>JPEG:</b> Lossy compression with quality control, smaller files for web display</li>
|
|
670
|
+
<li><b>PNG:</b> Lossless compression, preserves transparency, larger files</li>
|
|
671
|
+
<li><b>WebP:</b> Modern format with superior compression and quality control</li>
|
|
672
|
+
</ul>
|
|
673
|
+
|
|
674
|
+
<h3>Error Handling</h3>
|
|
675
|
+
<ul>
|
|
676
|
+
<li><b>Input Validation:</b> Comprehensive validation of image array structure and position mappings</li>
|
|
677
|
+
<li><b>Bounds Checking:</b> Automatic handling of out-of-bounds coordinates and array indices</li>
|
|
678
|
+
<li><b>Canvas Validation:</b> Ensures valid canvas dimensions with minimum size constraints</li>
|
|
679
|
+
<li><b>Memory Management:</b> Efficient memory usage with automatic cleanup and garbage collection</li>
|
|
680
|
+
<li><b>Position Validation:</b> Validates coordinate ranges for both absolute and normalized modes</li>
|
|
681
|
+
<li><b>Warning System:</b> Uses <code>node.warn()</code> for non-fatal issues without stopping flow execution</li>
|
|
682
|
+
</ul>
|
|
683
|
+
|
|
684
|
+
<h3>Performance</h3>
|
|
685
|
+
<ul>
|
|
686
|
+
<li><b>C++ Backend:</b> High-performance OpenCV-based processing with optimized build flags</li>
|
|
687
|
+
<li><b>Zero-Copy Operations:</b> Minimal memory allocation and copying for maximum efficiency</li>
|
|
688
|
+
<li><b>Parallel Processing:</b> Image placement operations processed in parallel using Promise.all()</li>
|
|
689
|
+
<li><b>Canvas Optimization:</b> Efficient canvas initialization and background rendering</li>
|
|
690
|
+
<li><b>Memory Pooling:</b> Reuses memory buffers across operations to reduce allocation overhead</li>
|
|
691
|
+
<li><b>Build Optimization:</b> Compiled with <code>-O3</code>, <code>-march=native</code>, <code>-ffast-math</code> flags</li>
|
|
692
|
+
<li><b>Position Caching:</b> Optimized coordinate calculations for repeated positioning operations</li>
|
|
693
|
+
</ul>
|
|
694
|
+
</script>
|
|
695
|
+
|
|
415
696
|
<script type="text/x-red" data-help-name="mosaic">
|
|
416
697
|
<p><b>rosepetal-mosaic</b> creates a composite image by placing multiple images from an input array onto a canvas at specified positions. This node enables precise control over image positioning, supports normalized coordinates, and offers flexible canvas configuration for creating complex image layouts.</p>
|
|
417
698
|
|