@rosepetal/node-red-contrib-image-tools 1.1.3
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/.gitattributes +6 -0
- package/.github/workflows/build-prebuild.yml +326 -0
- package/LICENSE +13 -0
- package/README.md +161 -0
- package/artifacts/darwin-arm64/package.json +25 -0
- package/artifacts/linux-arm64/package.json +26 -0
- package/artifacts/linux-x64/package.json +26 -0
- package/artifacts/linuxmusl-x64/package.json +26 -0
- package/assets/flow_time_example.gif +0 -0
- package/assets/nodes/io/array-in-demo.gif +0 -0
- package/assets/nodes/io/array-out-demo.gif +0 -0
- package/assets/nodes/io/array-select-demo.gif +0 -0
- package/assets/nodes/io/image-in-demo.gif +0 -0
- package/assets/nodes/mix/concat-demo.gif +0 -0
- package/assets/nodes/mix/mosaic-demo.gif +0 -0
- package/assets/nodes/transform/crop-demo.gif +0 -0
- package/assets/nodes/transform/filter-demo.gif +0 -0
- package/assets/nodes/transform/padding-demo.gif +0 -0
- package/assets/nodes/transform/resize-demo.gif +0 -0
- package/assets/nodes/transform/rotate-demo.gif +0 -0
- package/docs/nodes/blend/add-mask.md +275 -0
- package/docs/nodes/blend/add-masks.md +284 -0
- package/docs/nodes/blend/blend.md +248 -0
- package/docs/nodes/io/array-in.md +119 -0
- package/docs/nodes/io/array-out.md +150 -0
- package/docs/nodes/io/array-select.md +157 -0
- package/docs/nodes/io/image-in.md +131 -0
- package/docs/nodes/io/image-out.md +179 -0
- package/docs/nodes/io/queue.md +57 -0
- package/docs/nodes/io/save-file.md +30 -0
- package/docs/nodes/mix/advanced-mosaic.md +108 -0
- package/docs/nodes/mix/concat.md +127 -0
- package/docs/nodes/mix/mosaic.md +146 -0
- package/docs/nodes/specialized/cropBB.md +271 -0
- package/docs/nodes/specialized/image-align.md +426 -0
- package/docs/nodes/transform/crop.md +132 -0
- package/docs/nodes/transform/draw.md +77 -0
- package/docs/nodes/transform/filter.md +84 -0
- package/docs/nodes/transform/padding.md +133 -0
- package/docs/nodes/transform/resize.md +158 -0
- package/docs/nodes/transform/rotate.md +121 -0
- package/docs/nodes/util/block-detect.md +46 -0
- package/install.sh +144 -0
- package/node-red-contrib-image-tools/lib/cpp-bridge.js +224 -0
- package/node-red-contrib-image-tools/lib/node-utils.js +529 -0
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.html +590 -0
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +241 -0
- package/node-red-contrib-image-tools/nodes/blend/add-mask.html +449 -0
- package/node-red-contrib-image-tools/nodes/blend/add-mask.js +170 -0
- package/node-red-contrib-image-tools/nodes/blend/add-masks.html +703 -0
- package/node-red-contrib-image-tools/nodes/blend/add-masks.js +321 -0
- package/node-red-contrib-image-tools/nodes/blend/blend.html +552 -0
- package/node-red-contrib-image-tools/nodes/blend/blend.js +124 -0
- package/node-red-contrib-image-tools/nodes/io/array-in.html +110 -0
- package/node-red-contrib-image-tools/nodes/io/array-in.js +113 -0
- package/node-red-contrib-image-tools/nodes/io/array-out.html +125 -0
- package/node-red-contrib-image-tools/nodes/io/array-out.js +213 -0
- package/node-red-contrib-image-tools/nodes/io/array-select.html +156 -0
- package/node-red-contrib-image-tools/nodes/io/array-select.js +187 -0
- package/node-red-contrib-image-tools/nodes/io/folder-in.html +248 -0
- package/node-red-contrib-image-tools/nodes/io/folder-in.js +335 -0
- package/node-red-contrib-image-tools/nodes/io/image-in.html +146 -0
- package/node-red-contrib-image-tools/nodes/io/image-in.js +143 -0
- package/node-red-contrib-image-tools/nodes/io/image-out.html +506 -0
- package/node-red-contrib-image-tools/nodes/io/image-out.js +545 -0
- package/node-red-contrib-image-tools/nodes/io/queue.html +119 -0
- package/node-red-contrib-image-tools/nodes/io/queue.js +191 -0
- package/node-red-contrib-image-tools/nodes/io/save-file.html +243 -0
- package/node-red-contrib-image-tools/nodes/io/save-file.js +440 -0
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +2149 -0
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +195 -0
- package/node-red-contrib-image-tools/nodes/mix/concat.html +390 -0
- package/node-red-contrib-image-tools/nodes/mix/concat.js +112 -0
- package/node-red-contrib-image-tools/nodes/mix/mosaic.html +550 -0
- package/node-red-contrib-image-tools/nodes/mix/mosaic.js +151 -0
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.html +268 -0
- package/node-red-contrib-image-tools/nodes/specialized/cropBB.js +277 -0
- package/node-red-contrib-image-tools/nodes/specialized/image-align.html +528 -0
- package/node-red-contrib-image-tools/nodes/specialized/image-align.js +306 -0
- package/node-red-contrib-image-tools/nodes/transform/crop.html +410 -0
- package/node-red-contrib-image-tools/nodes/transform/crop.js +149 -0
- package/node-red-contrib-image-tools/nodes/transform/draw.html +719 -0
- package/node-red-contrib-image-tools/nodes/transform/draw.js +509 -0
- package/node-red-contrib-image-tools/nodes/transform/filter.html +578 -0
- package/node-red-contrib-image-tools/nodes/transform/filter.js +177 -0
- package/node-red-contrib-image-tools/nodes/transform/padding.html +475 -0
- package/node-red-contrib-image-tools/nodes/transform/padding.js +142 -0
- package/node-red-contrib-image-tools/nodes/transform/resize.html +429 -0
- package/node-red-contrib-image-tools/nodes/transform/resize.js +162 -0
- package/node-red-contrib-image-tools/nodes/transform/rotate.html +299 -0
- package/node-red-contrib-image-tools/nodes/transform/rotate.js +141 -0
- package/node-red-contrib-image-tools/nodes/util/block-detect.html +85 -0
- package/node-red-contrib-image-tools/nodes/util/block-detect.js +136 -0
- package/node-red-contrib-image-tools/nodes/util/clean-debug.html +201 -0
- package/node-red-contrib-image-tools/nodes/util/clean-debug.js +393 -0
- package/node-red-contrib-image-tools/package.json +64 -0
- package/npm/darwin-arm64/lib/.gitkeep +1 -0
- package/npm/darwin-arm64/package.json +25 -0
- package/npm/darwin-x64/lib/.gitkeep +1 -0
- package/npm/darwin-x64/package.json +25 -0
- package/npm/linux-arm64/lib/.gitkeep +1 -0
- package/npm/linux-arm64/package.json +26 -0
- package/npm/linux-x64/lib/.gitkeep +1 -0
- package/npm/linux-x64/package.json +26 -0
- package/npm/linuxmusl-x64/lib/.gitkeep +1 -0
- package/npm/linuxmusl-x64/package.json +26 -0
- package/npm/win32-x64/lib/.gitkeep +1 -0
- package/npm/win32-x64/package.json +25 -0
- package/package.json +74 -0
- package/rosepetal-image-engine/binding.gyp +153 -0
- package/rosepetal-image-engine/package.json +19 -0
- package/rosepetal-image-engine/src/add-bbs.cpp +433 -0
- package/rosepetal-image-engine/src/add-mask.cpp +240 -0
- package/rosepetal-image-engine/src/add-masks.cpp +638 -0
- package/rosepetal-image-engine/src/advanced-mosaic.cpp +740 -0
- package/rosepetal-image-engine/src/blend.cpp +200 -0
- package/rosepetal-image-engine/src/concat.cpp +329 -0
- package/rosepetal-image-engine/src/crop.cpp +139 -0
- package/rosepetal-image-engine/src/draw.cpp +414 -0
- package/rosepetal-image-engine/src/filter.cpp +230 -0
- package/rosepetal-image-engine/src/filters/kernels.h +171 -0
- package/rosepetal-image-engine/src/image-align.cpp +551 -0
- package/rosepetal-image-engine/src/main.cpp +36 -0
- package/rosepetal-image-engine/src/mosaic.cpp +373 -0
- package/rosepetal-image-engine/src/padding.cpp +124 -0
- package/rosepetal-image-engine/src/resize.cpp +210 -0
- package/rosepetal-image-engine/src/rotate.cpp +177 -0
- package/rosepetal-image-engine/src/utils.h +563 -0
- package/rosepetal-image-engine/test-formats.js +119 -0
- package/scripts/build-opencv-static.ps1 +166 -0
- package/scripts/build-opencv-static.sh +147 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Build and publish pre-built native binaries for all supported platforms
|
|
2
|
+
# Follows Sharp's pattern: platform-specific npm packages with statically linked OpenCV
|
|
3
|
+
|
|
4
|
+
name: Build Pre-built Binaries
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- 'v*'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
inputs:
|
|
12
|
+
publish:
|
|
13
|
+
description: 'Publish to npm'
|
|
14
|
+
required: false
|
|
15
|
+
default: 'false'
|
|
16
|
+
type: boolean
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
OPENCV_VERSION: '4.9.0'
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
# =============================================================================
|
|
23
|
+
# Linux x64 (glibc) - Ubuntu
|
|
24
|
+
# =============================================================================
|
|
25
|
+
linux-x64:
|
|
26
|
+
runs-on: ubuntu-22.04
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Setup Node.js
|
|
31
|
+
uses: actions/setup-node@v4
|
|
32
|
+
with:
|
|
33
|
+
node-version: '20'
|
|
34
|
+
registry-url: 'https://registry.npmjs.org'
|
|
35
|
+
|
|
36
|
+
- name: Install build dependencies
|
|
37
|
+
run: |
|
|
38
|
+
sudo apt-get update
|
|
39
|
+
sudo apt-get install -y \
|
|
40
|
+
build-essential cmake ninja-build \
|
|
41
|
+
libjpeg-dev libpng-dev libwebp-dev zlib1g-dev
|
|
42
|
+
|
|
43
|
+
- name: Cache OpenCV
|
|
44
|
+
id: cache-opencv
|
|
45
|
+
uses: actions/cache@v4
|
|
46
|
+
with:
|
|
47
|
+
path: /home/runner/opencv-static
|
|
48
|
+
key: opencv-${{ env.OPENCV_VERSION }}-linux-x64-static-v6
|
|
49
|
+
|
|
50
|
+
- name: Build OpenCV static
|
|
51
|
+
if: steps.cache-opencv.outputs.cache-hit != 'true'
|
|
52
|
+
env:
|
|
53
|
+
OPENCV_VERSION: ${{ env.OPENCV_VERSION }}
|
|
54
|
+
INSTALL_DIR: /home/runner/opencv-static
|
|
55
|
+
run: |
|
|
56
|
+
chmod +x scripts/build-opencv-static.sh
|
|
57
|
+
bash scripts/build-opencv-static.sh
|
|
58
|
+
|
|
59
|
+
- name: Build native addon
|
|
60
|
+
working-directory: rosepetal-image-engine
|
|
61
|
+
env:
|
|
62
|
+
npm_config_opencv_include_dir: /home/runner/opencv-static/include/opencv4
|
|
63
|
+
npm_config_opencv_lib_dir: /home/runner/opencv-static/lib
|
|
64
|
+
PKG_CONFIG_PATH: /home/runner/opencv-static/lib/pkgconfig
|
|
65
|
+
run: |
|
|
66
|
+
npm install
|
|
67
|
+
npx node-gyp rebuild
|
|
68
|
+
|
|
69
|
+
- name: Copy addon to package
|
|
70
|
+
run: |
|
|
71
|
+
mkdir -p npm/linux-x64/lib
|
|
72
|
+
cp rosepetal-image-engine/build/Release/addon.node npm/linux-x64/lib/
|
|
73
|
+
|
|
74
|
+
- name: Test addon loads
|
|
75
|
+
run: |
|
|
76
|
+
node -e "const addon = require('./npm/linux-x64/lib/addon.node'); console.log('Addon loaded successfully, exports:', Object.keys(addon))"
|
|
77
|
+
|
|
78
|
+
- name: Upload artifact
|
|
79
|
+
uses: actions/upload-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
name: linux-x64
|
|
82
|
+
path: npm/linux-x64/
|
|
83
|
+
|
|
84
|
+
# =============================================================================
|
|
85
|
+
# Linux ARM64 (glibc) - Ubuntu ARM
|
|
86
|
+
# =============================================================================
|
|
87
|
+
linux-arm64:
|
|
88
|
+
runs-on: ubuntu-22.04-arm
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- name: Setup Node.js
|
|
93
|
+
uses: actions/setup-node@v4
|
|
94
|
+
with:
|
|
95
|
+
node-version: '20'
|
|
96
|
+
registry-url: 'https://registry.npmjs.org'
|
|
97
|
+
|
|
98
|
+
- name: Install build dependencies
|
|
99
|
+
run: |
|
|
100
|
+
sudo apt-get update
|
|
101
|
+
sudo apt-get install -y \
|
|
102
|
+
build-essential cmake ninja-build \
|
|
103
|
+
libjpeg-dev libpng-dev libwebp-dev zlib1g-dev
|
|
104
|
+
|
|
105
|
+
- name: Cache OpenCV
|
|
106
|
+
id: cache-opencv
|
|
107
|
+
uses: actions/cache@v4
|
|
108
|
+
with:
|
|
109
|
+
path: /home/runner/opencv-static
|
|
110
|
+
key: opencv-${{ env.OPENCV_VERSION }}-linux-arm64-static-v6
|
|
111
|
+
|
|
112
|
+
- name: Build OpenCV static
|
|
113
|
+
if: steps.cache-opencv.outputs.cache-hit != 'true'
|
|
114
|
+
env:
|
|
115
|
+
OPENCV_VERSION: ${{ env.OPENCV_VERSION }}
|
|
116
|
+
INSTALL_DIR: /home/runner/opencv-static
|
|
117
|
+
run: |
|
|
118
|
+
chmod +x scripts/build-opencv-static.sh
|
|
119
|
+
bash scripts/build-opencv-static.sh
|
|
120
|
+
|
|
121
|
+
- name: Build native addon
|
|
122
|
+
working-directory: rosepetal-image-engine
|
|
123
|
+
env:
|
|
124
|
+
npm_config_opencv_include_dir: /home/runner/opencv-static/include/opencv4
|
|
125
|
+
npm_config_opencv_lib_dir: /home/runner/opencv-static/lib
|
|
126
|
+
PKG_CONFIG_PATH: /home/runner/opencv-static/lib/pkgconfig
|
|
127
|
+
run: |
|
|
128
|
+
npm install
|
|
129
|
+
npx node-gyp rebuild
|
|
130
|
+
|
|
131
|
+
- name: Copy addon to package
|
|
132
|
+
run: |
|
|
133
|
+
mkdir -p npm/linux-arm64/lib
|
|
134
|
+
cp rosepetal-image-engine/build/Release/addon.node npm/linux-arm64/lib/
|
|
135
|
+
|
|
136
|
+
- name: Test addon loads
|
|
137
|
+
run: |
|
|
138
|
+
node -e "const addon = require('./npm/linux-arm64/lib/addon.node'); console.log('Addon loaded successfully, exports:', Object.keys(addon))"
|
|
139
|
+
|
|
140
|
+
- name: Upload artifact
|
|
141
|
+
uses: actions/upload-artifact@v4
|
|
142
|
+
with:
|
|
143
|
+
name: linux-arm64
|
|
144
|
+
path: npm/linux-arm64/
|
|
145
|
+
|
|
146
|
+
# =============================================================================
|
|
147
|
+
# Linux x64 (musl) - Alpine
|
|
148
|
+
# =============================================================================
|
|
149
|
+
linuxmusl-x64:
|
|
150
|
+
runs-on: ubuntu-22.04
|
|
151
|
+
container:
|
|
152
|
+
image: node:20-alpine
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v4
|
|
155
|
+
|
|
156
|
+
- name: Install build dependencies
|
|
157
|
+
run: |
|
|
158
|
+
apk add --no-cache \
|
|
159
|
+
bash curl unzip \
|
|
160
|
+
build-base cmake ninja python3 \
|
|
161
|
+
libjpeg-turbo-dev libpng-dev libwebp-dev zlib-dev \
|
|
162
|
+
linux-headers
|
|
163
|
+
|
|
164
|
+
- name: Cache OpenCV
|
|
165
|
+
id: cache-opencv
|
|
166
|
+
uses: actions/cache@v4
|
|
167
|
+
with:
|
|
168
|
+
path: /root/opencv-static
|
|
169
|
+
key: opencv-${{ env.OPENCV_VERSION }}-linuxmusl-x64-static-v6
|
|
170
|
+
|
|
171
|
+
- name: Build OpenCV static
|
|
172
|
+
if: steps.cache-opencv.outputs.cache-hit != 'true'
|
|
173
|
+
env:
|
|
174
|
+
OPENCV_VERSION: ${{ env.OPENCV_VERSION }}
|
|
175
|
+
INSTALL_DIR: /root/opencv-static
|
|
176
|
+
run: |
|
|
177
|
+
chmod +x scripts/build-opencv-static.sh
|
|
178
|
+
bash scripts/build-opencv-static.sh
|
|
179
|
+
|
|
180
|
+
- name: Build native addon
|
|
181
|
+
working-directory: rosepetal-image-engine
|
|
182
|
+
env:
|
|
183
|
+
npm_config_opencv_include_dir: /root/opencv-static/include/opencv4
|
|
184
|
+
npm_config_opencv_lib_dir: /root/opencv-static/lib
|
|
185
|
+
PKG_CONFIG_PATH: /root/opencv-static/lib/pkgconfig
|
|
186
|
+
run: |
|
|
187
|
+
npm install
|
|
188
|
+
npx node-gyp rebuild
|
|
189
|
+
|
|
190
|
+
- name: Copy addon to package
|
|
191
|
+
run: |
|
|
192
|
+
mkdir -p npm/linuxmusl-x64/lib
|
|
193
|
+
cp rosepetal-image-engine/build/Release/addon.node npm/linuxmusl-x64/lib/
|
|
194
|
+
|
|
195
|
+
- name: Test addon loads
|
|
196
|
+
run: |
|
|
197
|
+
node -e "const addon = require('./npm/linuxmusl-x64/lib/addon.node'); console.log('Addon loaded successfully, exports:', Object.keys(addon))"
|
|
198
|
+
|
|
199
|
+
- name: Upload artifact
|
|
200
|
+
uses: actions/upload-artifact@v4
|
|
201
|
+
with:
|
|
202
|
+
name: linuxmusl-x64
|
|
203
|
+
path: npm/linuxmusl-x64/
|
|
204
|
+
|
|
205
|
+
# =============================================================================
|
|
206
|
+
# macOS ARM64 (Apple Silicon)
|
|
207
|
+
# =============================================================================
|
|
208
|
+
darwin-arm64:
|
|
209
|
+
runs-on: macos-14
|
|
210
|
+
steps:
|
|
211
|
+
- uses: actions/checkout@v4
|
|
212
|
+
|
|
213
|
+
- name: Setup Node.js
|
|
214
|
+
uses: actions/setup-node@v4
|
|
215
|
+
with:
|
|
216
|
+
node-version: '20'
|
|
217
|
+
registry-url: 'https://registry.npmjs.org'
|
|
218
|
+
|
|
219
|
+
- name: Install build dependencies
|
|
220
|
+
run: |
|
|
221
|
+
brew install cmake ninja jpeg libpng webp
|
|
222
|
+
|
|
223
|
+
- name: Cache OpenCV
|
|
224
|
+
id: cache-opencv
|
|
225
|
+
uses: actions/cache@v4
|
|
226
|
+
with:
|
|
227
|
+
path: /Users/runner/opencv-static
|
|
228
|
+
key: opencv-${{ env.OPENCV_VERSION }}-darwin-arm64-static-v6
|
|
229
|
+
|
|
230
|
+
- name: Build OpenCV static
|
|
231
|
+
if: steps.cache-opencv.outputs.cache-hit != 'true'
|
|
232
|
+
env:
|
|
233
|
+
OPENCV_VERSION: ${{ env.OPENCV_VERSION }}
|
|
234
|
+
INSTALL_DIR: /Users/runner/opencv-static
|
|
235
|
+
run: |
|
|
236
|
+
chmod +x scripts/build-opencv-static.sh
|
|
237
|
+
bash scripts/build-opencv-static.sh
|
|
238
|
+
|
|
239
|
+
- name: Build native addon
|
|
240
|
+
working-directory: rosepetal-image-engine
|
|
241
|
+
env:
|
|
242
|
+
npm_config_opencv_include_dir: /Users/runner/opencv-static/include/opencv4
|
|
243
|
+
npm_config_opencv_lib_dir: /Users/runner/opencv-static/lib
|
|
244
|
+
PKG_CONFIG_PATH: /Users/runner/opencv-static/lib/pkgconfig
|
|
245
|
+
run: |
|
|
246
|
+
npm install
|
|
247
|
+
npx node-gyp rebuild
|
|
248
|
+
|
|
249
|
+
- name: Copy addon to package
|
|
250
|
+
run: |
|
|
251
|
+
mkdir -p npm/darwin-arm64/lib
|
|
252
|
+
cp rosepetal-image-engine/build/Release/addon.node npm/darwin-arm64/lib/
|
|
253
|
+
|
|
254
|
+
- name: Test addon loads
|
|
255
|
+
run: |
|
|
256
|
+
node -e "const addon = require('./npm/darwin-arm64/lib/addon.node'); console.log('Addon loaded successfully, exports:', Object.keys(addon))"
|
|
257
|
+
|
|
258
|
+
- name: Upload artifact
|
|
259
|
+
uses: actions/upload-artifact@v4
|
|
260
|
+
with:
|
|
261
|
+
name: darwin-arm64
|
|
262
|
+
path: npm/darwin-arm64/
|
|
263
|
+
|
|
264
|
+
# =============================================================================
|
|
265
|
+
# Windows x64 - DISABLED (needs more work on static OpenCV linking)
|
|
266
|
+
# =============================================================================
|
|
267
|
+
# win32-x64:
|
|
268
|
+
# runs-on: windows-2022
|
|
269
|
+
# steps:
|
|
270
|
+
# - uses: actions/checkout@v4
|
|
271
|
+
# ...
|
|
272
|
+
|
|
273
|
+
# =============================================================================
|
|
274
|
+
# Publish all packages to npm
|
|
275
|
+
# =============================================================================
|
|
276
|
+
publish:
|
|
277
|
+
needs: [linux-x64, linux-arm64, linuxmusl-x64, darwin-arm64]
|
|
278
|
+
runs-on: ubuntu-22.04
|
|
279
|
+
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
|
|
280
|
+
steps:
|
|
281
|
+
- uses: actions/checkout@v4
|
|
282
|
+
|
|
283
|
+
- name: Setup Node.js
|
|
284
|
+
uses: actions/setup-node@v4
|
|
285
|
+
with:
|
|
286
|
+
node-version: '20'
|
|
287
|
+
registry-url: 'https://registry.npmjs.org'
|
|
288
|
+
|
|
289
|
+
- name: Download all artifacts
|
|
290
|
+
uses: actions/download-artifact@v4
|
|
291
|
+
with:
|
|
292
|
+
path: artifacts
|
|
293
|
+
|
|
294
|
+
- name: Prepare packages
|
|
295
|
+
run: |
|
|
296
|
+
# Copy artifacts to npm directories
|
|
297
|
+
for platform in linux-x64 linux-arm64 linuxmusl-x64 darwin-arm64; do
|
|
298
|
+
cp -r artifacts/$platform/* npm/$platform/
|
|
299
|
+
done
|
|
300
|
+
|
|
301
|
+
- name: Verify all addons exist
|
|
302
|
+
run: |
|
|
303
|
+
for platform in linux-x64 linux-arm64 linuxmusl-x64 darwin-arm64; do
|
|
304
|
+
if [ ! -f "npm/$platform/lib/addon.node" ]; then
|
|
305
|
+
echo "ERROR: Missing addon.node for $platform"
|
|
306
|
+
exit 1
|
|
307
|
+
fi
|
|
308
|
+
echo "✓ Found addon.node for $platform ($(stat -c%s "npm/$platform/lib/addon.node") bytes)"
|
|
309
|
+
done
|
|
310
|
+
|
|
311
|
+
- name: Publish platform packages
|
|
312
|
+
env:
|
|
313
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
314
|
+
run: |
|
|
315
|
+
for platform in linux-x64 linux-arm64 linuxmusl-x64 darwin-arm64; do
|
|
316
|
+
echo "Publishing @rosepetal/node-red-contrib-image-tools-$platform..."
|
|
317
|
+
cd npm/$platform
|
|
318
|
+
npm publish --access public || echo "Package may already exist"
|
|
319
|
+
cd ../..
|
|
320
|
+
done
|
|
321
|
+
|
|
322
|
+
- name: Publish main package
|
|
323
|
+
env:
|
|
324
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
325
|
+
run: |
|
|
326
|
+
npm publish --access public || echo "Package may already exist"
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2025 Rosepetal
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Node-RED Image Processing Toolkit
|
|
2
|
+
|
|
3
|
+
A comprehensive Node-RED package providing 17 specialized nodes for high-performance image processing using C++ OpenCV backend. Perfect for computer vision workflows, batch processing, and automated image manipulation.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## 🚀 Quick Start
|
|
8
|
+
|
|
9
|
+
### Installation (users)
|
|
10
|
+
**From Node-RED (Palette Manager)**
|
|
11
|
+
- Open Palette Manager → Install → search `@rosepetal/node-red-contrib-image-tools`.
|
|
12
|
+
|
|
13
|
+
**From npm (CLI, default)**
|
|
14
|
+
```bash
|
|
15
|
+
cd ~/.node-red
|
|
16
|
+
npm install @rosepetal/node-red-contrib-image-tools
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Development installation (build from source)
|
|
20
|
+
For contributors or platforms without a prebuilt binary:
|
|
21
|
+
```bash
|
|
22
|
+
./install.sh
|
|
23
|
+
# or manual steps:
|
|
24
|
+
cd rosepetal-image-engine && npm install && npm run build
|
|
25
|
+
cd ../node-red-contrib-image-tools && npm install
|
|
26
|
+
cd ~/.node-red && npm install /path/to/node-red-contrib-image-tools
|
|
27
|
+
```
|
|
28
|
+
> npm installs fetch prebuilt binaries for common platforms; build from source only if you are developing or a prebuilt is unavailable.
|
|
29
|
+
|
|
30
|
+
### Requirements
|
|
31
|
+
- Node.js 16+ with node-gyp support
|
|
32
|
+
- OpenCV 4.x (auto-detected via pkg-config)
|
|
33
|
+
- C++ compiler with C++17 support
|
|
34
|
+
|
|
35
|
+
## 📋 Node Categories
|
|
36
|
+
|
|
37
|
+
### I/O Nodes - Data Flow Management
|
|
38
|
+
| Node | Purpose | Key Features |
|
|
39
|
+
|------|---------|-------------|
|
|
40
|
+
| **[image-in](docs/nodes/io/image-in.md)** | Load images from filesystem | JPEG/PNG/WebP/etc. support, Sharp backend |
|
|
41
|
+
| **[image-out](docs/nodes/io/image-out.md)** | Save images with timestamp naming | Auto-naming, overwrite protection, format conversion |
|
|
42
|
+
| **[save-file](docs/nodes/io/save-file.md)** | Write any payload to disk | Auto-detect images/JSON/text, overwrite guard, format control |
|
|
43
|
+
| **[array-in](docs/nodes/io/array-in.md)** | Collect data into positioned arrays | Dynamic positioning, batch collection |
|
|
44
|
+
| **[array-out](docs/nodes/io/array-out.md)** | Assemble arrays from multiple sources | Timeout protection, ordered assembly |
|
|
45
|
+
| **[array-select](docs/nodes/io/array-select.md)** | Extract elements with flexible selection | Python-like slicing, range selection |
|
|
46
|
+
| **[queue](docs/nodes/io/queue.md)** | Buffer and pace message delivery | FIFO gating, rate control, timed expiry |
|
|
47
|
+
|
|
48
|
+
### Transform Nodes - Image Processing
|
|
49
|
+
| Node | Purpose | Key Features |
|
|
50
|
+
|------|---------|-------------|
|
|
51
|
+
| **[resize](docs/nodes/transform/resize.md)** | Scale images with aspect ratio control | Proportional scaling, multiple modes |
|
|
52
|
+
| **[rotate](docs/nodes/transform/rotate.md)** | Rotate images with custom padding | Sub-pixel precision, background colors |
|
|
53
|
+
| **[crop](docs/nodes/transform/crop.md)** | Extract regions with pixel/normalized coords | Dynamic coordinates, bounds checking |
|
|
54
|
+
| **[padding](docs/nodes/transform/padding.md)** | Add configurable margins | Color customization, flexible sizing |
|
|
55
|
+
| **[filter](docs/nodes/transform/filter.md)** | Apply enhancement filters | Blur, sharpen, edge, emboss, Gaussian |
|
|
56
|
+
| **[draw](docs/nodes/transform/draw.md)** | Overlay points and lines on images | Normalized coordinates, typed inputs, C++ compositing |
|
|
57
|
+
|
|
58
|
+
### Mix Nodes - Image Composition
|
|
59
|
+
| Node | Purpose | Key Features |
|
|
60
|
+
|------|---------|-------------|
|
|
61
|
+
| **[concat](docs/nodes/mix/concat.md)** | Combine images horizontally/vertically | Direction control, padding strategies |
|
|
62
|
+
| **[mosaic](docs/nodes/mix/mosaic.md)** | Position images on canvas | Coordinate positioning, manual placement |
|
|
63
|
+
| **[advanced-mosaic](docs/nodes/mix/advanced-mosaic.md)** | Complex layouts with custom positioning | Pixel-perfect control, layering |
|
|
64
|
+
|
|
65
|
+
### Blend Nodes - Advanced Compositing
|
|
66
|
+
| Node | Purpose | Key Features |
|
|
67
|
+
|------|---------|-------------|
|
|
68
|
+
| **[blend](docs/nodes/blend/blend.md)** | Alpha blend two images with opacity | Background removal, color tolerance |
|
|
69
|
+
| **[add-mask](docs/nodes/blend/add-mask.md)** | Apply polygon-based masks to regions | Coordinate arrays, mask strength control |
|
|
70
|
+
|
|
71
|
+
### Specialized Nodes - AI/ML Integration
|
|
72
|
+
| Node | Purpose | Key Features |
|
|
73
|
+
|------|---------|-------------|
|
|
74
|
+
| **[cropBB](docs/nodes/specialized/cropBB.md)** | Extract crops from AI bounding boxes | Object detection integration, confidence filtering |
|
|
75
|
+
| **[image-align](docs/nodes/specialized/image-align.md)** | Ultra-fast image alignment using ECC algorithm | Translation correction, speed presets, real-time processing |
|
|
76
|
+
|
|
77
|
+
### Utility Nodes - Diagnostics
|
|
78
|
+
| Node | Purpose | Key Features |
|
|
79
|
+
|------|---------|-------------|
|
|
80
|
+
| **clean-debug** | Safe debug output for large payloads | Buffer cleaning, sidebar/console toggles, enable/disable button |
|
|
81
|
+
| **[block-detect](docs/nodes/util/block-detect.md)** | Background watchdog for event-loop blocking | No wires, configurable thresholds, live status metrics |
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Architecture & Performance
|
|
85
|
+
|
|
86
|
+
### Two-Tier Design
|
|
87
|
+
- **JavaScript Layer**: Node-RED integration, validation, I/O handling
|
|
88
|
+
- **C++ Layer**: OpenCV-powered image processing for maximum performance
|
|
89
|
+
|
|
90
|
+
### Performance Benefits
|
|
91
|
+
- **Faster!** than pure JavaScript implementations
|
|
92
|
+
- **Parallel processing** for array operations
|
|
93
|
+
- **Memory efficient** with optimized algorithms
|
|
94
|
+
- **Async operations** with real-time performance timing
|
|
95
|
+
|
|
96
|
+
### Image Data Format
|
|
97
|
+
```javascript
|
|
98
|
+
{
|
|
99
|
+
data: Buffer, // Raw pixel data
|
|
100
|
+
width: number, // Image width in pixels
|
|
101
|
+
height: number, // Image height in pixels
|
|
102
|
+
channels: number, // Channel count (1, 3, 4)
|
|
103
|
+
colorSpace: string, // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
|
|
104
|
+
dtype: string // "uint8" (standard)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 🛠️ Development
|
|
109
|
+
|
|
110
|
+
### Project Structure
|
|
111
|
+
```
|
|
112
|
+
node-red-contrib-image-tools/
|
|
113
|
+
├── docs/nodes/ # Individual node documentation
|
|
114
|
+
├── nodes/ # Node-RED node implementations
|
|
115
|
+
│ ├── io/ # I/O nodes
|
|
116
|
+
│ ├── transform/ # Transform nodes
|
|
117
|
+
│ ├── mix/ # Composition nodes
|
|
118
|
+
│ ├── blend/ # Blending nodes
|
|
119
|
+
│ └── specialized/ # AI/ML nodes
|
|
120
|
+
├── lib/ # Shared utilities
|
|
121
|
+
└── assets/ # Documentation assets
|
|
122
|
+
|
|
123
|
+
rosepetal-image-engine/ # C++ processing engine
|
|
124
|
+
├── src/ # OpenCV implementations
|
|
125
|
+
├── binding.gyp # Node.js addon configuration
|
|
126
|
+
└── package.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Adding New Nodes
|
|
130
|
+
1. Implement C++ processing in `rosepetal-image-engine/src/`
|
|
131
|
+
2. Export function in `src/main.cpp`
|
|
132
|
+
3. Create Node-RED wrapper in appropriate `nodes/` category
|
|
133
|
+
4. Add comprehensive documentation following existing patterns
|
|
134
|
+
|
|
135
|
+
## 🚨 Troubleshooting
|
|
136
|
+
|
|
137
|
+
### Common Issues
|
|
138
|
+
- **Build Failures**: Ensure OpenCV 4.x installed and pkg-config available
|
|
139
|
+
- **Missing Nodes**: Check Node-RED installation path and package registration
|
|
140
|
+
- **Performance Issues**: Verify C++ addon built with optimization flags
|
|
141
|
+
- **Memory Problems**: Process large images in smaller batches
|
|
142
|
+
|
|
143
|
+
### Performance Tips
|
|
144
|
+
- Use **raw format** for processing chains (fastest)
|
|
145
|
+
- Process **arrays when possible** for parallel execution
|
|
146
|
+
- Choose **appropriate output formats** for your destination
|
|
147
|
+
- Monitor **node status displays** for timing information
|
|
148
|
+
|
|
149
|
+
## 🤝 Contributing
|
|
150
|
+
|
|
151
|
+
- **Issues**: Report bugs and feature requests via GitHub
|
|
152
|
+
- **Pull Requests**: Contributions welcome for new nodes and optimizations
|
|
153
|
+
- **Documentation**: Help improve guides and examples
|
|
154
|
+
|
|
155
|
+
## 📄 License
|
|
156
|
+
|
|
157
|
+
This project is part of the Rosepetal development toolkit for Node-RED image processing applications.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
**💡 Pro Tip**: Start with simple single-node workflows, then combine them into complex processing pipelines as you become familiar with the image format and node interactions.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rosepetal/node-red-contrib-image-tools-darwin-arm64",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Prebuilt native binary for macOS ARM64 (Apple Silicon)",
|
|
5
|
+
"os": ["darwin"],
|
|
6
|
+
"cpu": ["arm64"],
|
|
7
|
+
"main": "lib/addon.node",
|
|
8
|
+
"files": ["lib/addon.node"],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"author": "Rosepetal SL (https://www.rosepetal.ai)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/rosepetal-ai/node-red-contrib-image-tools.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/rosepetal-ai/node-red-contrib-image-tools/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/rosepetal-ai/node-red-contrib-image-tools#readme",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=16.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rosepetal/node-red-contrib-image-tools-linux-arm64",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Prebuilt native binary for Linux ARM64 (glibc)",
|
|
5
|
+
"os": ["linux"],
|
|
6
|
+
"cpu": ["arm64"],
|
|
7
|
+
"libc": ["glibc"],
|
|
8
|
+
"main": "lib/addon.node",
|
|
9
|
+
"files": ["lib/addon.node"],
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": "Rosepetal SL (https://www.rosepetal.ai)",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/rosepetal-ai/node-red-contrib-image-tools.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/rosepetal-ai/node-red-contrib-image-tools/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/rosepetal-ai/node-red-contrib-image-tools#readme",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rosepetal/node-red-contrib-image-tools-linux-x64",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Prebuilt native binary for Linux x64 (glibc)",
|
|
5
|
+
"os": ["linux"],
|
|
6
|
+
"cpu": ["x64"],
|
|
7
|
+
"libc": ["glibc"],
|
|
8
|
+
"main": "lib/addon.node",
|
|
9
|
+
"files": ["lib/addon.node"],
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": "Rosepetal SL (https://www.rosepetal.ai)",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/rosepetal-ai/node-red-contrib-image-tools.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/rosepetal-ai/node-red-contrib-image-tools/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/rosepetal-ai/node-red-contrib-image-tools#readme",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rosepetal/node-red-contrib-image-tools-linuxmusl-x64",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Prebuilt native binary for Linux x64 (musl/Alpine)",
|
|
5
|
+
"os": ["linux"],
|
|
6
|
+
"cpu": ["x64"],
|
|
7
|
+
"libc": ["musl"],
|
|
8
|
+
"main": "lib/addon.node",
|
|
9
|
+
"files": ["lib/addon.node"],
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": "Rosepetal SL (https://www.rosepetal.ai)",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/rosepetal-ai/node-red-contrib-image-tools.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/rosepetal-ai/node-red-contrib-image-tools/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/rosepetal-ai/node-red-contrib-image-tools#readme",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|