@rosepetal/node-red-contrib-image-tools 1.7.0 → 1.8.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 (35) hide show
  1. package/.github/workflows/build-prebuild.yml +1 -1
  2. package/README.md +39 -21
  3. package/docs/index.md +156 -0
  4. package/docs/nodes/blend/add-bbs.md +116 -0
  5. package/docs/nodes/blend/add-mask.md +67 -224
  6. package/docs/nodes/blend/add-masks.md +74 -196
  7. package/docs/nodes/blend/blend.md +84 -200
  8. package/docs/nodes/io/folder-in.md +92 -0
  9. package/docs/nodes/io/image-in.md +61 -52
  10. package/docs/nodes/io/image-out.md +114 -93
  11. package/docs/nodes/mix/advanced-mosaic.md +124 -78
  12. package/docs/nodes/mix/concat.md +71 -56
  13. package/docs/nodes/mix/mosaic.md +81 -91
  14. package/docs/nodes/specialized/cropBB.md +76 -214
  15. package/docs/nodes/specialized/heat-diff.md +111 -0
  16. package/docs/nodes/specialized/image-align.md +125 -387
  17. package/docs/nodes/transform/color-convert.md +101 -0
  18. package/docs/nodes/transform/crop.md +56 -58
  19. package/docs/nodes/transform/draw.md +46 -26
  20. package/docs/nodes/transform/filter.md +110 -46
  21. package/docs/nodes/transform/padding.md +55 -55
  22. package/docs/nodes/transform/resize.md +81 -56
  23. package/docs/nodes/transform/rotate.md +67 -50
  24. package/node-red-contrib-image-tools/nodes/specialized/image-align.html +11 -4
  25. package/node-red-contrib-image-tools/nodes/specialized/image-align.js +2 -1
  26. package/npm/darwin-arm64/package.json +1 -1
  27. package/npm/darwin-x64/package.json +1 -1
  28. package/npm/linux-arm64/package.json +1 -1
  29. package/npm/linux-x64/package.json +1 -1
  30. package/npm/linuxmusl-x64/package.json +1 -1
  31. package/npm/win32-x64/package.json +1 -1
  32. package/package.json +6 -6
  33. package/rosepetal-image-engine/src/heat-diff.cpp +4 -0
  34. package/rosepetal-image-engine/src/image-align.cpp +71 -3
  35. package/scripts/build-opencv-static.sh +6 -0
@@ -1,8 +1,23 @@
1
+ ---
2
+ title: "Concat Node - Join Images Side by Side or Stacked"
3
+ description: "Join an array of images into one image in Node-RED, to the right, left, down or up, padding or resizing the ones that differ in size. Part of @rosepetal/node-red-contrib-image-tools."
4
+ head:
5
+ - - meta
6
+ - name: "keywords"
7
+ content: "node-red, concat, concatenate images, image strip, side by side, opencv, rosepetal"
8
+ - - meta
9
+ - property: "og:title"
10
+ content: "Concat Node - @rosepetal/node-red-contrib-image-tools"
11
+ - - meta
12
+ - property: "og:description"
13
+ content: "Join an array of images into one image in Node-RED, to the right, left, down or up, padding or resizing the ones that differ in size."
14
+ ---
15
+
1
16
  # Concat Node
2
17
 
3
18
  ## Purpose & Use Cases
4
19
 
5
- The `concat` node combines multiple images horizontally or vertically into a single composite image. It automatically handles alignment and supports flexible input formats for creating image strips, panoramas, and comparison layouts.
20
+ The `concat` node joins the images of an array side by side or one above the other into a single image. Images of different height (or width) are padded with a colour or scaled to match.
6
21
 
7
22
  **Real-World Applications:**
8
23
  - **Before/After Comparisons**: Side-by-side image comparisons for treatments, edits, or changes
@@ -16,112 +31,112 @@ The `concat` node combines multiple images horizontally or vertically into a sin
16
31
  ## Input/Output Specification
17
32
 
18
33
  ### Inputs
19
- - **Image Array**: Array of image objects to combine
34
+ - **Image Array**: an array of raw image objects or encoded JPEG/PNG/WebP/BMP `Buffer`s, read from **Input** (`msg.payload` by default). A single image is treated as an array of one.
35
+ - The images may have different sizes and color spaces. They are all converted to one color space before joining: RGBA if any image is RGBA, else BGRA, RGB, BGR and GRAY, in that order.
20
36
 
21
37
  ### Outputs
22
- - **Combined Image**: Single image containing all input images arranged in sequence
23
- - **Expanded Dimensions**: Width or height increased to accommodate all images
24
- - **Format Options**: Raw image object or encoded file formats
38
+ One output:
39
+ - **Combined Image**: one image, written to **Output** (`msg.payload` by default), as a raw image object or an encoded `Buffer` (JPEG/PNG/WebP)
40
+ - **Dimensions**: joining to the right or left, the width is the sum of the widths (the scaled widths with Resize to max) and the height the largest height; joining down or up, the other way round
41
+ - `msg.performance.rpimage.<key>`: `{ conversion, task, total }` in milliseconds
25
42
 
26
43
  ## Configuration Options
27
44
 
28
- ### Input/Output Paths
29
- - **Input From**: `msg.payload` (default), `flow.*`, `global.*`
30
- - **Output To**: `msg.payload` (default), `flow.*`, `global.*`
45
+ | Property | Default | Meaning |
46
+ |----------|---------|---------|
47
+ | Input | `msg.payload` | Where the array is read (`msg`, `flow` or `global`) |
48
+ | Output | `msg.payload` | Where the joined image is written (`msg`, `flow` or `global`) |
49
+ | Output Format | Raw (fastest) | Raw (fastest), JPEG, PNG or WebP, with Quality (`90`), PNG Optimize and the WebP options as in [resize](../transform/resize.md#output-format-options) |
50
+ | Debug / Debug Width | off / `200` | **Show processed image** under the node in the editor |
51
+ | Direction | → Right | → Right, ← Left, ↓ Down or ↑ Up |
52
+ | Strategy | Pad at start | How images of a different height (or width) are matched: Pad at start, Pad at end, Pad both sides or Resize to max |
53
+ | Pad colour | `#000000` | Colour of the padding |
54
+ | Inference | off | Under **Advanced options**: **Transform inference coordinates**, with **Inf. Input** and **Inf. Output** (both `msg.inference`) |
55
+
56
+ The editor has no Name field for this node, so its timings are recorded under `msg.performance.rpimage.rp_concat`.
31
57
 
32
58
  ### Direction Options
33
- - **Right**: Images arranged left-to-right horizontally (width increases)
34
- - **Left**: Images arranged right-to-left horizontally (width increases)
35
- - **Down**: Images stacked top-to-bottom vertically (height increases)
36
- - **Up**: Images stacked bottom-to-top vertically (height increases)
59
+ - **→ Right**: Images arranged left-to-right in array order
60
+ - **← Left**: the → Right result mirrored horizontally: the first image ends up on the right, and every image is mirrored too
61
+ - **↓ Down**: Images stacked top-to-bottom in array order
62
+ - **↑ Up**: Images stacked bottom-to-top (the first image at the bottom), not mirrored
37
63
 
38
64
  ### Strategy Options
39
-
40
- #### Padding Strategies (for dimension mismatches)
41
- - **pad-start**: Add padding at beginning of smaller images
42
- - **pad-end**: Add padding at end of smaller images
43
- - **pad-both**: Center smaller images with padding on both sides
44
- - **resize**: Resize all images to match largest dimension
65
+ For a horizontal join the strategies act on the height; for a vertical join, on the width.
66
+ - **Pad at start**: padding above (or to the left of) the smaller images
67
+ - **Pad at end**: padding below (or to the right of) the smaller images
68
+ - **Pad both sides**: the smaller images centred, with padding on both sides
69
+ - **Resize to max**: every image scaled, keeping its aspect ratio, to the largest height (or width)
45
70
 
46
71
  ### Color Configuration
47
- - **Padding Color**: Background color for padding areas when images have different sizes
48
- - **Default**: Black
49
- - **Formats**: RGB (`rgb(255,0,0)`)
72
+ - **Pad colour**: picked with the editor's colour picker (`#RRGGBB`); default black
73
+ - When the joined image has alpha (RGBA, BGRA), the padding is transparent
50
74
 
51
- ### Output Format Options
52
- - **Raw**: Standard image object (fastest for processing chains)
53
- - **JPEG**: Compressed with quality control
54
- - **PNG**: Lossless with transparency support
55
- - **WebP**: Modern format with excellent compression
75
+ ### Inference
76
+ With **Transform inference coordinates** checked, **Inf. Input** must hold an array with one entry per input image, each the inference array of that image. The node maps every detection (with `raw_boxes`) and segmentation polygon into the joined image and writes a single flat array to **Inf. Output**; other entries are copied unchanged and bitmap masks are not transformed. The image sizes are read from the raw image objects: with encoded `Buffer` inputs the coordinates come out as `NaN`.
56
77
 
57
- ## Performance Notes
78
+ ## Status and Errors
58
79
 
59
- ### C++ Backend Processing
60
- - **Optimized Composition**: Efficient memory allocation for composite canvas
61
- - **Alignment Algorithms**: Fast positioning calculations for different alignment modes
62
- - **Batch Processing**: All images processed in single operation
63
- - **Memory Management**: Minimal copying with direct canvas placement
80
+ - **Success**: green dot `OK: 1 img in <t> ms (conv <c> ms | task <k> ms)` (one joined image), plus the preview format with Debug on
81
+ - **Failure**: `msg.error` is set, the **first** input image is written to **Output**, a warning is logged, the status shows a red ring `Error: <first 30 characters>` and the message is still sent. An invalid array gives `Invalid image list`
64
82
 
65
- ### Dimension Handling
66
- - **Automatic Sizing**: Canvas automatically sized to fit all images
67
- - **Alignment Compensation**: Background fill for dimension mismatches
68
- - **Memory Efficiency**: Pre-calculates final dimensions to minimize allocations
83
+ ## Performance Notes
84
+
85
+ - The images are converted, padded or scaled and joined in one call to the native OpenCV addon, on the libuv thread pool
69
86
 
70
87
  ## Real-World Examples
71
88
 
72
89
  ### Before/After Comparison
73
90
  ```
74
91
  [Original Image] → [Array-In: pos=0] ┐
75
- [Processed Image] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Direction=Right, Strategy=pad-both] → [Comparison Strip]
92
+ [Processed Image] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Direction=Right, Strategy=Pad both sides] → [Comparison Strip]
76
93
  ```
77
- Create side-by-side before/after comparisons with centered alignment.
94
+ Create side-by-side before/after comparisons with centered alignment. Array-In and Array-Out, used in these examples to build the array, are part of [`@rosepetal/node-red-contrib-utils`](https://docs.rosepetal.ai/flows/node-red-contrib-utils/nodes/io/array-in).
78
95
 
79
96
  ### Product Catalog Strip
80
97
  ```
81
- [Product Photos Array] → [Concat: Direction=Right, Strategy=resize] → [Catalog Strip]
98
+ [Product Photos Array] → [Concat: Direction=Right, Strategy=Resize to max] → [Catalog Strip]
82
99
  ```
83
100
  Combine multiple product views, resizing to uniform height.
84
101
 
85
102
  ### Progress Timeline
86
103
  ```
87
104
  [Step 1 Image] → [Array-In: pos=0] ┐
88
- [Step 2 Image] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Direction=Down, Strategy=pad-both] → [Process Timeline]
105
+ [Step 2 Image] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Direction=Down, Strategy=Pad both sides] → [Process Timeline]
89
106
  [Step 3 Image] → [Array-In: pos=2] ┘
90
107
  ```
91
108
  Document multi-step processes vertically with centered alignment.
92
109
 
93
110
  ### Social Media Carousel
94
111
  ```
95
- [Image Array] → [Resize: Same height] → [Concat: Direction=Right, Strategy=pad-start] → [Carousel Image]
112
+ [Image Array] → [Resize: Height=Set to 600, Width empty] → [Concat: Direction=Right, Strategy=Pad at start] → [Carousel Image]
96
113
  ```
97
114
  Create horizontal image strips for social media.
98
115
 
99
116
  ### Report Layout
100
117
  ```
101
118
  [Chart Image] → [Array-In: pos=0] ┐
102
- [Photo Evidence] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Vertical] → [Report Section]
119
+ [Photo Evidence] → [Array-In: pos=1] ├→ [Array-Out] → [Concat: Direction=Down] → [Report Section]
103
120
  [Data Table] → [Array-In: pos=2] ┘
104
121
  ```
105
- Combine different types of visual content into reports.
122
+ Combine different types of visual content into reports (Direction ↓ Down).
106
123
 
107
124
  ## Common Issues & Troubleshooting
108
125
 
109
126
  ### Dimension Mismatches
110
- - **Issue**: Images with different sizes create alignment problems
111
- - **Solution**: Use resize node to standardize dimensions before concat
112
- - **Alternative**: Use appropriate alignment settings to handle size differences
127
+ - **Issue**: Images with different sizes leave padded bands
128
+ - **Solution**: Choose **Resize to max**, or use a [resize](../transform/resize.md) node to standardize dimensions before concat
129
+
130
+ ### Mirrored Images
131
+ - **Issue**: With **← Left** the images come out mirrored
132
+ - **Cause**: The node mirrors the whole joined image to reverse the order
133
+ - **Solution**: Reverse the array before the node and use **→ Right**
113
134
 
114
135
  ### Memory Usage with Large Images
115
136
  - **Issue**: Concatenating many large images uses significant memory
116
137
  - **Solution**: Resize images to appropriate sizes before concatenation
117
- - **Monitoring**: Watch memory usage with large image arrays
118
-
119
- ### Aspect Ratio Problems
120
- - **Issue**: Combined image has awkward proportions
121
- - **Planning**: Consider final aspect ratio when planning image arrangement
122
- - **Solution**: Use padding or cropping to improve final composition
123
138
 
124
- ### Color Consistency
125
- - **Issue**: Images have different color profiles or brightness
126
- - **Preprocessing**: Apply consistent color correction before concatenation
127
- - **Solution**: Use filter nodes to normalize appearance
139
+ ### Unexpected Transparency
140
+ - **Issue**: Padding is transparent instead of the pad colour
141
+ - **Cause**: One RGBA image makes the whole result RGBA, and padding on an image with alpha is transparent
142
+ - **Solution**: Convert the images to RGB first with [color-convert](../transform/color-convert.md)
@@ -1,8 +1,23 @@
1
+ ---
2
+ title: "Mosaic Node - Place Images on a Canvas"
3
+ description: "Place the images of an array on a canvas in Node-RED at the positions set in the node, in pixels or normalized coordinates. Part of @rosepetal/node-red-contrib-image-tools."
4
+ head:
5
+ - - meta
6
+ - name: "keywords"
7
+ content: "node-red, mosaic, canvas, image composition, collage, positioning, opencv, rosepetal"
8
+ - - meta
9
+ - property: "og:title"
10
+ content: "Mosaic Node - @rosepetal/node-red-contrib-image-tools"
11
+ - - meta
12
+ - property: "og:description"
13
+ content: "Place the images of an array on a canvas in Node-RED at the positions set in the node, in pixels or normalized coordinates."
14
+ ---
15
+
1
16
  # Mosaic Node
2
17
 
3
18
  ## Purpose & Use Cases
4
19
 
5
- The `mosaic` node provides manual positioning of multiple images on a canvas with precise coordinate control. It creates composite images by placing images at specific positions, supporting both normalized (0-1) and pixel coordinates for flexible layout creation.
20
+ The `mosaic` node places the images of an array on a canvas of a fixed size, each at a position set in the node, in pixels or normalized (0-1) coordinates. The images keep their own size; to scale or rotate them, use [advanced-mosaic](./advanced-mosaic.md).
6
21
 
7
22
  **Real-World Applications:**
8
23
  - **Custom Layouts**: Create precise image arrangements with exact positioning
@@ -16,131 +31,106 @@ The `mosaic` node provides manual positioning of multiple images on a canvas wit
16
31
  ## Input/Output Specification
17
32
 
18
33
  ### Inputs
19
- - **Image Array**: Array of image objects to position on canvas
20
- - **Position Configuration**: Position mappings defined in node configuration
21
- - **Canvas Parameters**: Canvas dimensions and background settings
34
+ - **Image Array**: an array of raw image objects or encoded JPEG/PNG/WebP/BMP `Buffer`s, read from **Input from** (`msg.payload` by default). A single image is treated as an array of one.
35
+ - **Positions**: set in the node's **Image Positions** table, not taken from the message.
36
+ - **Canvas Width / Canvas Height**: a number, or read from `msg`, `flow` or `global` for each message.
22
37
 
23
38
  ### Outputs
24
- - **Composite Image**: Single image with positioned elements on canvas
25
- - **Fixed Canvas Size**: Canvas dimensions as configured
26
- - **Format Options**: Raw image object or encoded file formats
27
-
28
- ## Configuration Options
29
-
30
- ### Input/Output Paths
31
- - **Input From**: `msg.payload` (default), `flow.*`, `global.*`
32
- - **Output To**: `msg.payload` (default), `flow.*`, `global.*`
39
+ One output:
40
+ - **Composite Image**: one image of Canvas Width × Canvas Height, written to **Output to** (`msg.payload` by default), as a raw image object or an encoded `Buffer` (JPEG/PNG/WebP)
41
+ - `msg.performance.rpimage.<key>`: `{ conversion, task, total }` in milliseconds
33
42
 
34
- ### Canvas Configuration
43
+ The canvas takes the color space of the inputs: RGBA if any image is RGBA, else BGRA, RGB, BGR and GRAY, in that order. Every image is converted to it.
35
44
 
36
- #### Canvas Dimensions
37
- - **Canvas Width**: Width of output canvas in pixels
38
- - **Canvas Height**: Height of output canvas in pixels
39
- - **Sources**: Number, `msg.*`, `flow.*`, `global.*`
45
+ ## Configuration Options
40
46
 
41
- #### Background Settings
42
- - **Background Color**: Color for empty canvas areas
43
- - **Default**: Black
44
- - **Formats**: RGB (`rgb(255,0,0)`)
47
+ | Property | Default | Meaning |
48
+ |----------|---------|---------|
49
+ | Name | empty | Label of the node; also the key of its timings in `msg.performance.rpimage` |
50
+ | Input from | `msg.payload` | Where the array is read (`msg`, `flow` or `global`) |
51
+ | Output to | `msg.payload` | Where the composite is written (`msg`, `flow` or `global`) |
52
+ | Output Format | Raw (fastest) | Raw (fastest), JPEG, PNG or WebP, with Quality (`90`), PNG Optimize and the WebP options as in [resize](../transform/resize.md#output-format-options) |
53
+ | Debug / Debug Width | off / `200` | **Show processed image** under the node in the editor |
54
+ | Canvas Width | `800` | Width of the canvas in pixels |
55
+ | Canvas Height | `600` | Height of the canvas in pixels |
56
+ | Background Color | `#000000` | Colour of the canvas where no image is placed (opaque, also on canvases with alpha) |
57
+ | Normalized Coords | off | X and Y as fractions of the canvas size (0-1); off, in pixels |
58
+ | Image Positions | empty; opening the editor adds one row: image 0 at 0, 0 | Table of **Array Index**, **X Position**, **Y Position**; **Add Position** and **Remove** manage the rows |
59
+ | Inference | off | Under **Advanced options**: **Transform inference coordinates**, with **Inf. Input** and **Inf. Output** (both `msg.inference`) |
45
60
 
46
61
  ### Positioning System
47
62
 
48
63
  #### Coordinate System
49
- - **Normalized Mode**: Values from 0.0 to 1.0 (relative to canvas dimensions)
50
- - **Pixel Mode**: Absolute pixel coordinates
64
+ - **Normalized Coords off**: X and Y in pixels, rounded to whole pixels
65
+ - **Normalized Coords on**: X and Y multiplied by the canvas width and height
51
66
 
52
- #### Position Configuration
53
- - **Position Mappings**: Array of position configurations in node editor
54
- - **Array Index**: Which image from input array to position
55
- - **X/Y Coordinates**: Position on canvas (normalized or pixel)
56
- - **Per-Image Control**: Individual positioning for each image
67
+ #### Image Positions
68
+ - **Array Index**: which image of the input array to place (0 = first). The same image can be placed in several rows; a row whose index is outside the array is ignored without a warning
69
+ - **X Position / Y Position**: where the top-left corner of the image goes. The image is placed at its own size; the part that falls outside the canvas is cut off
70
+ - **Overlaps**: the pixels of an image replace what is below them; alpha is not blended. With up to 4 rows, later rows are drawn over earlier ones; with more than 4 rows an addon built with OpenMP places the rows in parallel, and the order of overlapping images is then not guaranteed
57
71
 
58
- ### Output Format Options
59
- - **Raw**: Standard image object (fastest for processing chains)
60
- - **JPEG**: Compressed with quality control
61
- - **PNG**: Lossless with transparency support
62
- - **WebP**: Modern format with excellent compression
72
+ ### Inference
73
+ With **Transform inference coordinates** checked, **Inf. Input** must hold an array with one entry per input image, each the inference array of that image. Every detection (with `raw_boxes`) and segmentation polygon is mapped to each place its image was put on the canvas (clipped to the canvas) and the node writes a single flat array to **Inf. Output**; other entries are copied unchanged. Bitmap masks are not transformed. The image sizes are read from the raw image objects: with encoded `Buffer` inputs the coordinates come out as `NaN`.
63
74
 
64
- ## Performance Notes
75
+ ## Status and Errors
65
76
 
66
- ### C++ Backend Processing
67
- - **Optimized Canvas Composition**: Efficient positioning and placement on fixed canvas
68
- - **Memory Management**: Pre-allocated canvas with optimal memory usage
69
- - **Batch Placement**: All images positioned in single C++ operation
70
- - **Coordinate Validation**: Automatic bounds checking and position validation
77
+ - **Success**: green dot `OK: <n> pos in <t> ms (conv <c> ms | task <k> ms)`, where n is the number of rows whose Array Index is inside the array, or `OK: empty canvas in <t> ms` when there is none. With Debug on the status reads `OK: 1 img in <t> ms (conv <c> ms | task <k> ms) | <format> (<n> pos)`, or `(empty canvas)` at the end
78
+ - **Failure**: `msg.error` is set, the **first** input image is written to **Output to**, a warning is logged, the status shows a red ring `Error: <first 30 characters>` and the message is still sent. An invalid array gives `Invalid image list`; a canvas size of 0 or less gives `Canvas dimensions must be positive numbers`
79
+
80
+ ## Performance Notes
71
81
 
72
- ### Position Processing
73
- - **Coordinate Transformation**: Efficient conversion between normalized and pixel coordinates
74
- - **Bounds Checking**: Automatic validation of positions within canvas boundaries
75
- - **Layer Management**: Proper handling of image placement order and overlaps
82
+ - The canvas is composed in one call to the native OpenCV addon, on the libuv thread pool
76
83
 
77
84
  ## Real-World Examples
78
85
 
79
- ### Custom Dashboard Layout
80
- ```javascript
81
- // In function node: set specific positions for dashboard elements
86
+ ### Four-Panel Layout
87
+ Image Positions (pixels, canvas 800 × 600, four 400 × 300 images):
82
88
 
83
- { arrayIndex: 0, x: 0, y: 0 } // Chart at top-left
84
- { arrayIndex: 1, x: 400, y: 0 } // KPI at top-right
85
- { arrayIndex: 2, x: 0, y: 300 } // Graph at bottom-left
86
- { arrayIndex: 3, x: 400, y: 300 } // Table at bottom-right
89
+ | Array Index | X Position | Y Position |
90
+ |-------------|------------|------------|
91
+ | 0 | 0 | 0 |
92
+ | 1 | 400 | 0 |
93
+ | 2 | 0 | 300 |
94
+ | 3 | 400 | 300 |
87
95
 
88
96
  ```
89
- ```
90
- [Dashboard Elements] → [Function: Set Positions] → [Mosaic: 800x600 canvas] → [Dashboard]
97
+ [Four images] → [Array-Out] → [Mosaic: 800x600 canvas] → [Image-Out]
91
98
  ```
92
99
 
93
100
  ### Template-Based Layout
94
- ```javascript
95
- // Predefined layout template positions
101
+ Image Positions with **Normalized Coords** on:
96
102
 
97
- { arrayIndex: 0, x: 0.1, y: 0.1 } // Normalized coordinates
98
- { arrayIndex: 1, x: 0.6, y: 0.1 } // 10% and 60% from left
99
- { arrayIndex: 2, x: 0.1, y: 0.6 } // 10% and 60% from top
103
+ | Array Index | X Position | Y Position |
104
+ |-------------|------------|------------|
105
+ | 0 | 0.1 | 0.1 |
106
+ | 1 | 0.6 | 0.1 |
107
+ | 2 | 0.1 | 0.6 |
100
108
 
101
- ```
102
- ```
103
- [Content Images] → [Function: Apply Template] → [Mosaic: Normalized coords] → [Layout]
104
- ```
109
+ The images keep their size, so they must fit the cells of the template; resize them first if needed.
105
110
 
106
- ### Overlay Composition
111
+ ### Logo Overlay
107
112
  ```
108
113
  [Base Image] → [Array-In: pos=0] ┐
109
- [Logo Overlay] → [Array-In: pos=1] ├→ [Function: Set Positions] → [Mosaic: Canvas] → [Branded Image]
110
- [Text Overlay] → [Array-In: pos=2] ┘
111
- ```
112
- Position logos and text overlays at specific coordinates.
113
-
114
- ### Print Layout Design
115
- ```javascript
116
- // Precise positioning for print layout
117
- canvasWidth = 1200; // Print width
118
- canvasHeight = 1800; // Print height
119
- { arrayIndex: 0, x: 100, y: 100 } // Header image
120
- { arrayIndex: 1, x: 100, y: 400 } // Content image
121
- { arrayIndex: 2, x: 100, y: 1200 } // Footer image
122
-
114
+ [Logo] → [Array-In: pos=1] ├→ [Array-Out] → [Mosaic: rows 0 at 0,0 and 1 at 20,20] → [Branded Image]
123
115
  ```
116
+ Place a logo over the top-left corner of a photo; the canvas has the size of the photo. Array-In and Array-Out are part of [`@rosepetal/node-red-contrib-utils`](https://docs.rosepetal.ai/flows/node-red-contrib-utils/nodes/io/array-in).
124
117
 
125
118
  ## Common Issues & Troubleshooting
126
119
 
127
- ### Position Configuration Errors
128
- - **Issue**: Images not appearing or positioned incorrectly
129
- - **Solution**: Verify arrayIndex values match input array length
130
- - **Validation**: Check that positions array contains valid coordinates
120
+ ### Images Missing from the Canvas
121
+ - **Issue**: An image does not appear
122
+ - **Solution**: Check that its **Array Index** is smaller than the length of the input array, and that its position is inside the canvas
131
123
 
132
- ### Coordinate System Confusion
124
+ ### Coordinate System Confusion
133
125
  - **Issue**: Images appearing in wrong locations
134
- - **Solution**: Verify normalized vs. pixel coordinate mode matches your values
126
+ - **Solution**: Check **Normalized Coords** against your values
135
127
  - **Normalized**: Use 0-1 values for relative positioning
136
128
  - **Pixel**: Use absolute coordinates within canvas bounds
137
129
 
138
130
  ### Canvas Size Problems
139
- - **Issue**: Images clipped or positioned outside visible area
140
- - **Solution**: Ensure canvas dimensions accommodate all positioned images
141
- - **Planning**: Calculate required canvas size based on image positions and sizes
142
-
143
- ### Position Array Mismatches
144
- - **Issue**: ArrayIndex references non-existent images
145
- - **Result**: Images ignored with warnings logged
146
- - **Solution**: Validate arrayIndex values against input array length
131
+ - **Issue**: Images clipped at the edges
132
+ - **Solution**: Make the canvas large enough for the images at their own size, or resize them first
133
+
134
+ ### Dynamic Positions
135
+ - **Issue**: The positions must change per message
136
+ - **Cause**: Positions are fixed in the node configuration; only the canvas size can come from the message