@rosepetal/node-red-contrib-image-tools 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/nodes/io/image-out.md +5 -3
- package/install.sh +0 -8
- package/node-red-contrib-image-tools/lib/inference-transform.js +626 -0
- package/node-red-contrib-image-tools/nodes/blend/add-bbs.js +6 -10
- package/node-red-contrib-image-tools/nodes/io/image-out.html +383 -244
- package/node-red-contrib-image-tools/nodes/io/image-out.js +462 -280
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.html +72 -1
- package/node-red-contrib-image-tools/nodes/mix/advanced-mosaic.js +25 -0
- package/node-red-contrib-image-tools/nodes/mix/concat.html +74 -3
- package/node-red-contrib-image-tools/nodes/mix/concat.js +23 -0
- package/node-red-contrib-image-tools/nodes/mix/mosaic.html +72 -1
- package/node-red-contrib-image-tools/nodes/mix/mosaic.js +25 -0
- package/node-red-contrib-image-tools/nodes/transform/crop.html +76 -5
- package/node-red-contrib-image-tools/nodes/transform/crop.js +31 -0
- package/node-red-contrib-image-tools/nodes/transform/padding.html +76 -5
- package/node-red-contrib-image-tools/nodes/transform/padding.js +24 -0
- package/node-red-contrib-image-tools/nodes/transform/resize.html +76 -3
- package/node-red-contrib-image-tools/nodes/transform/resize.js +30 -0
- package/node-red-contrib-image-tools/nodes/transform/rotate.html +76 -3
- package/node-red-contrib-image-tools/nodes/transform/rotate.js +25 -0
- package/package.json +2 -35
- package/rosepetal-image-engine/src/add-bbs.cpp +13 -5
- package/scripts/dual-register.js +0 -30
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
color: '#A6C8A6',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: "" },
|
|
7
|
-
|
|
7
|
+
mode: { value: "single" },
|
|
8
|
+
folderPath: { value: "" },
|
|
8
9
|
folderPathType: { value: "str" },
|
|
9
10
|
filenamePrefix: { value: "" },
|
|
10
11
|
filenamePrefixType: { value: "str" },
|
|
@@ -12,9 +13,16 @@
|
|
|
12
13
|
filenameFullType: { value: "str" },
|
|
13
14
|
inputPath: { value: "payload" },
|
|
14
15
|
inputPathType: { value: "msg" },
|
|
16
|
+
saveConfig: { value: "payload" },
|
|
17
|
+
saveConfigType: { value: "msg" },
|
|
18
|
+
imageField: { value: "bitmap" },
|
|
19
|
+
filenameField: { value: "filename" },
|
|
20
|
+
filenameFieldType: { value: "item" },
|
|
21
|
+
outputDirField: { value: "outputDir" },
|
|
22
|
+
outputDirFieldType: { value: "item" },
|
|
15
23
|
outputFormat: { value: "jpg" },
|
|
16
24
|
outputQuality: { value: 90 },
|
|
17
|
-
|
|
25
|
+
pngCompression: { value: 8 },
|
|
18
26
|
webpLossless: { value: false },
|
|
19
27
|
webpEffort: { value: "" },
|
|
20
28
|
webpSmartSubsample: { value: false },
|
|
@@ -22,7 +30,6 @@
|
|
|
22
30
|
maxImages: { value: "" },
|
|
23
31
|
maxImagesType: { value: "num" },
|
|
24
32
|
active: { value: true },
|
|
25
|
-
// Debug configuration
|
|
26
33
|
debugEnabled: { value: false },
|
|
27
34
|
debugWidth: { value: 200 },
|
|
28
35
|
debugWidthType: { value: "num" }
|
|
@@ -77,20 +84,40 @@
|
|
|
77
84
|
}
|
|
78
85
|
},
|
|
79
86
|
oneditprepare: function() {
|
|
87
|
+
// Mode toggle
|
|
88
|
+
function toggleMode() {
|
|
89
|
+
var isMultiple = $('#node-input-mode').val() === 'multiple';
|
|
90
|
+
if (isMultiple) {
|
|
91
|
+
$('.imageout-single-mode').hide();
|
|
92
|
+
$('.imageout-multiple-mode').show();
|
|
93
|
+
} else {
|
|
94
|
+
$('.imageout-single-mode').show();
|
|
95
|
+
$('.imageout-multiple-mode').hide();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
$('#node-input-mode').change(toggleMode);
|
|
99
|
+
toggleMode();
|
|
100
|
+
|
|
101
|
+
// Item field custom type for typedInputs
|
|
102
|
+
var itemFieldType = {
|
|
103
|
+
value: 'item',
|
|
104
|
+
label: 'Item field',
|
|
105
|
+
icon: 'red/images/typedInput/json.svg'
|
|
106
|
+
};
|
|
107
|
+
|
|
80
108
|
// Initialize TypedInput for folder path
|
|
81
109
|
$("#node-input-folderPath").typedInput({
|
|
82
110
|
default: 'str',
|
|
83
111
|
types: ['str', 'msg', 'flow', 'global'],
|
|
84
112
|
typeField: "#node-input-folderPathType"
|
|
85
113
|
});
|
|
86
|
-
|
|
87
|
-
|
|
114
|
+
|
|
115
|
+
var jsonataTypeOption = {
|
|
88
116
|
value: 'jsonata',
|
|
89
117
|
label: 'JSONata',
|
|
90
118
|
icon: 'red/images/typedInput/expr.svg'
|
|
91
119
|
};
|
|
92
|
-
|
|
93
|
-
const nameTypes = ['str', 'msg', 'flow', 'global', jsonataTypeOption];
|
|
120
|
+
var nameTypes = ['str', 'msg', 'flow', 'global', jsonataTypeOption];
|
|
94
121
|
|
|
95
122
|
// Initialize TypedInput for filename prefix
|
|
96
123
|
$("#node-input-filenamePrefix").typedInput({
|
|
@@ -105,7 +132,7 @@
|
|
|
105
132
|
types: nameTypes,
|
|
106
133
|
typeField: "#node-input-filenameFullType"
|
|
107
134
|
});
|
|
108
|
-
|
|
135
|
+
|
|
109
136
|
// Initialize TypedInput for input path
|
|
110
137
|
$("#node-input-inputPath").typedInput({
|
|
111
138
|
default: 'msg',
|
|
@@ -113,63 +140,82 @@
|
|
|
113
140
|
typeField: "#node-input-inputPathType"
|
|
114
141
|
});
|
|
115
142
|
|
|
143
|
+
// Multiple mode TypedInputs
|
|
144
|
+
$("#node-input-saveConfig").typedInput({
|
|
145
|
+
default: 'msg',
|
|
146
|
+
types: ['msg', 'flow', 'global'],
|
|
147
|
+
typeField: "#node-input-saveConfigType"
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
$("#node-input-filenameField").typedInput({
|
|
151
|
+
default: 'item',
|
|
152
|
+
types: [itemFieldType, 'str', 'msg', 'flow', 'global'],
|
|
153
|
+
typeField: "#node-input-filenameFieldType"
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
$("#node-input-outputDirField").typedInput({
|
|
157
|
+
default: 'item',
|
|
158
|
+
types: [itemFieldType, 'str', 'msg', 'flow', 'global'],
|
|
159
|
+
typeField: "#node-input-outputDirFieldType"
|
|
160
|
+
});
|
|
161
|
+
|
|
116
162
|
// Initialize TypedInput for maximum images
|
|
117
163
|
$("#node-input-maxImages").typedInput({
|
|
118
164
|
default: 'num',
|
|
119
165
|
types: ['num', 'msg', 'flow', 'global'],
|
|
120
166
|
typeField: "#node-input-maxImagesType"
|
|
121
167
|
});
|
|
122
|
-
|
|
168
|
+
|
|
123
169
|
// Initialize debug width TypedInput
|
|
124
170
|
$("#node-input-debugWidth").typedInput({
|
|
125
171
|
default: 'num',
|
|
126
172
|
types: ['num', 'msg', 'flow', 'global'],
|
|
127
173
|
typeField: "#node-input-debugWidthType"
|
|
128
174
|
});
|
|
129
|
-
|
|
175
|
+
|
|
130
176
|
// Show/hide quality row based on format
|
|
131
177
|
function updateQualityVisibility() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
178
|
+
var format = $('#node-input-outputFormat').val();
|
|
179
|
+
var qualityRow = $('#quality-row');
|
|
180
|
+
var pngCompressionRow = $('#png-compression-row');
|
|
181
|
+
var webpLosslessRow = $('#webp-lossless-row');
|
|
182
|
+
var webpEffortRow = $('#webp-effort-row');
|
|
183
|
+
var webpSmartSubsampleRow = $('#webp-smartsubsample-row');
|
|
184
|
+
|
|
139
185
|
if (format === 'jpg') {
|
|
140
186
|
qualityRow.show();
|
|
141
|
-
|
|
187
|
+
pngCompressionRow.hide();
|
|
142
188
|
webpLosslessRow.hide();
|
|
143
189
|
webpEffortRow.hide();
|
|
144
190
|
webpSmartSubsampleRow.hide();
|
|
145
191
|
} else if (format === 'webp') {
|
|
146
192
|
qualityRow.show();
|
|
147
|
-
|
|
193
|
+
pngCompressionRow.hide();
|
|
148
194
|
webpLosslessRow.show();
|
|
149
195
|
webpEffortRow.show();
|
|
150
196
|
webpSmartSubsampleRow.show();
|
|
151
197
|
} else if (format === 'png') {
|
|
152
198
|
qualityRow.hide();
|
|
153
|
-
|
|
199
|
+
pngCompressionRow.show();
|
|
154
200
|
webpLosslessRow.hide();
|
|
155
201
|
webpEffortRow.hide();
|
|
156
202
|
webpSmartSubsampleRow.hide();
|
|
157
203
|
} else {
|
|
158
204
|
qualityRow.hide();
|
|
159
|
-
|
|
205
|
+
pngCompressionRow.hide();
|
|
160
206
|
webpLosslessRow.hide();
|
|
161
207
|
webpEffortRow.hide();
|
|
162
208
|
webpSmartSubsampleRow.hide();
|
|
163
209
|
}
|
|
164
210
|
}
|
|
165
|
-
|
|
211
|
+
|
|
166
212
|
$('#node-input-outputFormat').change(updateQualityVisibility);
|
|
167
213
|
updateQualityVisibility();
|
|
168
|
-
|
|
214
|
+
|
|
169
215
|
// Debug checkbox logic
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
216
|
+
var debugCheckbox = $('#node-input-debugEnabled');
|
|
217
|
+
var debugWidthRow = $('#debug-width-row');
|
|
218
|
+
|
|
173
219
|
function updateDebugWidthVisibility() {
|
|
174
220
|
if (debugCheckbox.prop('checked')) {
|
|
175
221
|
debugWidthRow.show();
|
|
@@ -177,17 +223,17 @@
|
|
|
177
223
|
debugWidthRow.hide();
|
|
178
224
|
}
|
|
179
225
|
}
|
|
180
|
-
|
|
226
|
+
|
|
181
227
|
debugCheckbox.change(updateDebugWidthVisibility);
|
|
182
228
|
updateDebugWidthVisibility();
|
|
183
|
-
|
|
229
|
+
|
|
184
230
|
// Initialize debug image display
|
|
185
231
|
initDebugImageDisplay();
|
|
186
232
|
}
|
|
187
233
|
};
|
|
188
234
|
RED.nodes.registerType('rp-image-out', _rpNodeCfg);
|
|
189
235
|
RED.nodes.registerType('image-out', Object.assign({}, _rpNodeCfg, { category: 'deprecated' }));
|
|
190
|
-
|
|
236
|
+
|
|
191
237
|
function sendToggleRequest(node, active, onSuccess, onError) {
|
|
192
238
|
$.ajax({
|
|
193
239
|
url: "image-out/" + node.id,
|
|
@@ -207,18 +253,18 @@
|
|
|
207
253
|
});
|
|
208
254
|
}
|
|
209
255
|
|
|
210
|
-
// Debug image display functionality
|
|
256
|
+
// Debug image display functionality
|
|
211
257
|
function initDebugImageDisplay() {
|
|
212
258
|
(function() {
|
|
213
259
|
var isSubscribed = false;
|
|
214
|
-
|
|
260
|
+
|
|
215
261
|
function subscribeToDebugImages() {
|
|
216
262
|
if (isSubscribed || typeof RED === 'undefined' || !RED.comms) return;
|
|
217
263
|
isSubscribed = true;
|
|
218
|
-
|
|
264
|
+
|
|
219
265
|
RED.comms.subscribe('debug-image', function(event, data) {
|
|
220
266
|
if (!data || !data.id) return;
|
|
221
|
-
|
|
267
|
+
|
|
222
268
|
try {
|
|
223
269
|
renderDebugImage(data);
|
|
224
270
|
} catch (err) {
|
|
@@ -226,25 +272,24 @@
|
|
|
226
272
|
}
|
|
227
273
|
});
|
|
228
274
|
}
|
|
229
|
-
|
|
275
|
+
|
|
230
276
|
function renderDebugImage(data) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
277
|
+
var nodeId = data.id;
|
|
278
|
+
var base64Data = data.data;
|
|
279
|
+
var format = data.format || 'unknown';
|
|
280
|
+
var mimeType = data.mimeType || 'jpeg';
|
|
281
|
+
|
|
236
282
|
if (!base64Data) {
|
|
237
283
|
removeDebugImage(nodeId);
|
|
238
284
|
return;
|
|
239
285
|
}
|
|
240
|
-
|
|
241
|
-
|
|
286
|
+
|
|
287
|
+
var nodeElement = document.getElementById(nodeId);
|
|
242
288
|
if (!nodeElement) return;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
289
|
+
|
|
290
|
+
var debugContainer = document.getElementById('debug-img-container-' + nodeId);
|
|
291
|
+
|
|
246
292
|
if (!debugContainer) {
|
|
247
|
-
// Create SVG foreignObject to embed HTML content in SVG
|
|
248
293
|
debugContainer = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
|
|
249
294
|
debugContainer.id = 'debug-img-container-' + nodeId;
|
|
250
295
|
debugContainer.setAttribute('x', '70');
|
|
@@ -252,9 +297,8 @@
|
|
|
252
297
|
debugContainer.setAttribute('width', '120');
|
|
253
298
|
debugContainer.setAttribute('height', '120');
|
|
254
299
|
debugContainer.style.overflow = 'visible';
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const img = document.createElement('img');
|
|
300
|
+
|
|
301
|
+
var img = document.createElement('img');
|
|
258
302
|
img.id = 'debug-img-' + nodeId;
|
|
259
303
|
img.style.width = '100%';
|
|
260
304
|
img.style.height = 'auto';
|
|
@@ -262,40 +306,39 @@
|
|
|
262
306
|
img.style.cursor = 'pointer';
|
|
263
307
|
img.style.maxHeight = '100px';
|
|
264
308
|
img.style.maxWidth = '100px';
|
|
265
|
-
|
|
309
|
+
|
|
266
310
|
img.onclick = function() {
|
|
267
311
|
removeDebugImage(nodeId);
|
|
268
312
|
};
|
|
269
|
-
|
|
313
|
+
|
|
270
314
|
debugContainer.appendChild(img);
|
|
271
315
|
nodeElement.appendChild(debugContainer);
|
|
272
316
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
|
|
317
|
+
|
|
318
|
+
var imgEl = document.getElementById('debug-img-' + nodeId);
|
|
319
|
+
|
|
320
|
+
if (imgEl) {
|
|
321
|
+
imgEl.src = 'data:image/' + mimeType + ';base64,' + base64Data;
|
|
322
|
+
imgEl.title = 'Debug image (click to hide)';
|
|
279
323
|
}
|
|
280
324
|
}
|
|
281
|
-
|
|
325
|
+
|
|
282
326
|
function removeDebugImage(nodeId) {
|
|
283
|
-
|
|
327
|
+
var debugContainer = document.getElementById('debug-img-container-' + nodeId);
|
|
284
328
|
if (debugContainer) {
|
|
285
329
|
debugContainer.remove();
|
|
286
330
|
}
|
|
287
331
|
}
|
|
288
|
-
|
|
332
|
+
|
|
289
333
|
function initializeWhenReady() {
|
|
290
334
|
if (typeof RED !== 'undefined' && RED.comms) {
|
|
291
335
|
subscribeToDebugImages();
|
|
292
|
-
|
|
293
|
-
// Clean up orphaned debug images periodically
|
|
336
|
+
|
|
294
337
|
setInterval(function() {
|
|
295
|
-
|
|
296
|
-
debugContainers.forEach(container
|
|
297
|
-
|
|
298
|
-
|
|
338
|
+
var debugContainers = document.querySelectorAll('[id^="debug-img-container-"]');
|
|
339
|
+
debugContainers.forEach(function(container) {
|
|
340
|
+
var nodeId = container.id.replace('debug-img-container-', '');
|
|
341
|
+
var nodeElement = document.getElementById(nodeId);
|
|
299
342
|
if (!nodeElement) {
|
|
300
343
|
container.remove();
|
|
301
344
|
}
|
|
@@ -305,7 +348,7 @@
|
|
|
305
348
|
setTimeout(initializeWhenReady, 100);
|
|
306
349
|
}
|
|
307
350
|
}
|
|
308
|
-
|
|
351
|
+
|
|
309
352
|
if (document.readyState === 'loading') {
|
|
310
353
|
document.addEventListener('DOMContentLoaded', initializeWhenReady);
|
|
311
354
|
} else {
|
|
@@ -320,65 +363,108 @@
|
|
|
320
363
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
321
364
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
322
365
|
</div>
|
|
323
|
-
|
|
366
|
+
|
|
324
367
|
<hr>
|
|
325
|
-
|
|
326
|
-
<!--
|
|
368
|
+
|
|
369
|
+
<!-- Mode Selection -->
|
|
327
370
|
<div class="form-row">
|
|
328
|
-
<label for="node-input-
|
|
329
|
-
<
|
|
330
|
-
|
|
371
|
+
<label for="node-input-mode"><i class="fa fa-list"></i> Mode</label>
|
|
372
|
+
<select id="node-input-mode" style="width: 200px;">
|
|
373
|
+
<option value="single">Single image</option>
|
|
374
|
+
<option value="multiple">Multiple images</option>
|
|
375
|
+
</select>
|
|
331
376
|
</div>
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
377
|
+
|
|
378
|
+
<!-- Single Mode Fields -->
|
|
379
|
+
<div class="imageout-single-mode">
|
|
380
|
+
<div class="form-row">
|
|
381
|
+
<label for="node-input-folderPath"><i class="fa fa-folder"></i> Folder Path</label>
|
|
382
|
+
<input type="text" id="node-input-folderPath" style="width: 70%;" placeholder="/path/to/save/folder">
|
|
383
|
+
<input type="hidden" id="node-input-folderPathType">
|
|
339
384
|
</div>
|
|
340
|
-
</div>
|
|
341
385
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
386
|
+
<div class="form-row">
|
|
387
|
+
<label for="node-input-filenamePrefix"><i class="fa fa-tag"></i> Filename Prefix</label>
|
|
388
|
+
<input type="text" id="node-input-filenamePrefix" style="width: 70%;" placeholder="image (optional)">
|
|
389
|
+
<input type="hidden" id="node-input-filenamePrefixType">
|
|
390
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
391
|
+
Pattern: [prefix]_YYYYMMDD_HHMMSS.[ext]
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<div class="form-row">
|
|
396
|
+
<label for="node-input-filenameFull"><i class="fa fa-file-text-o"></i> Full Filename</label>
|
|
397
|
+
<input type="text" id="node-input-filenameFull" style="width: 70%;" placeholder="photo.jpg (optional)">
|
|
398
|
+
<input type="hidden" id="node-input-filenameFullType">
|
|
399
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
400
|
+
Overrides prefix & timestamp when provided. Leave blank for automatic naming.
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
<hr>
|
|
405
|
+
|
|
406
|
+
<div class="form-row">
|
|
407
|
+
<label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
|
|
408
|
+
<input type="text" id="node-input-inputPath" style="width: 70%;">
|
|
409
|
+
<input type="hidden" id="node-input-inputPathType">
|
|
348
410
|
</div>
|
|
349
411
|
</div>
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
412
|
+
|
|
413
|
+
<!-- Multiple Mode Fields -->
|
|
414
|
+
<div class="imageout-multiple-mode" style="display: none;">
|
|
415
|
+
<div class="form-row">
|
|
416
|
+
<label for="node-input-saveConfig"><i class="fa fa-sign-in"></i> Input</label>
|
|
417
|
+
<input type="text" id="node-input-saveConfig" style="width: 70%;">
|
|
418
|
+
<input type="hidden" id="node-input-saveConfigType">
|
|
419
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
420
|
+
Array of objects, each containing an image and optional filename/folder.
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
|
|
424
|
+
<div class="form-row">
|
|
425
|
+
<label for="node-input-imageField"><i class="fa fa-picture-o"></i> Image field</label>
|
|
426
|
+
<input type="text" id="node-input-imageField" placeholder="bitmap" style="width: 200px;">
|
|
427
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
428
|
+
Key name holding the image data in each object.
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<div class="form-row">
|
|
433
|
+
<label for="node-input-outputDirField"><i class="fa fa-folder"></i> Output dir</label>
|
|
434
|
+
<input type="text" id="node-input-outputDirField" style="width: 70%;">
|
|
435
|
+
<input type="hidden" id="node-input-outputDirFieldType">
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div class="form-row">
|
|
439
|
+
<label for="node-input-filenameField"><i class="fa fa-file-text-o"></i> Filename</label>
|
|
440
|
+
<input type="text" id="node-input-filenameField" style="width: 70%;">
|
|
441
|
+
<input type="hidden" id="node-input-filenameFieldType">
|
|
442
|
+
</div>
|
|
358
443
|
</div>
|
|
359
|
-
|
|
444
|
+
|
|
360
445
|
<hr>
|
|
361
|
-
|
|
362
|
-
<!-- Output Format Configuration -->
|
|
446
|
+
|
|
447
|
+
<!-- Output Format Configuration (shared) -->
|
|
363
448
|
<div class="form-row">
|
|
364
449
|
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
365
450
|
<select id="node-input-outputFormat" style="width: 200px;">
|
|
366
451
|
<option value="jpg">JPEG</option>
|
|
367
452
|
<option value="png">PNG</option>
|
|
368
453
|
<option value="webp">WebP</option>
|
|
454
|
+
<option value="bmp">BMP</option>
|
|
369
455
|
</select>
|
|
370
456
|
</div>
|
|
371
|
-
|
|
457
|
+
|
|
372
458
|
<div class="form-row" id="quality-row">
|
|
373
459
|
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
374
460
|
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
375
461
|
<span style="margin-left: 10px; color: #666;">1-100 (JPEG/WebP only)</span>
|
|
376
462
|
</div>
|
|
377
|
-
|
|
378
|
-
<div class="form-row" id="png-
|
|
379
|
-
<label for="node-input-
|
|
380
|
-
<input type="
|
|
381
|
-
<
|
|
463
|
+
|
|
464
|
+
<div class="form-row" id="png-compression-row" style="display: none;">
|
|
465
|
+
<label for="node-input-pngCompression"><i class="fa fa-leaf"></i> Compression</label>
|
|
466
|
+
<input type="number" id="node-input-pngCompression" min="0" max="9" step="1" style="width: 70px;">
|
|
467
|
+
<span style="margin-left: 10px; color: #666;">0-9 (higher = smaller file, slower)</span>
|
|
382
468
|
</div>
|
|
383
469
|
|
|
384
470
|
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
@@ -398,10 +484,10 @@
|
|
|
398
484
|
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
399
485
|
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
400
486
|
</div>
|
|
401
|
-
|
|
487
|
+
|
|
402
488
|
<hr>
|
|
403
|
-
|
|
404
|
-
<!-- Protection Settings -->
|
|
489
|
+
|
|
490
|
+
<!-- Protection Settings (shared) -->
|
|
405
491
|
<div class="form-row">
|
|
406
492
|
<label for="node-input-overwriteProtection"><i class="fa fa-shield"></i> Protection</label>
|
|
407
493
|
<input type="checkbox" id="node-input-overwriteProtection" style="display:inline-block; width:auto; vertical-align:baseline;" checked>
|
|
@@ -414,14 +500,14 @@
|
|
|
414
500
|
<input type="hidden" id="node-input-maxImagesType">
|
|
415
501
|
<span style="margin-left: 10px; color: #666;">0 or blank keeps all files.</span>
|
|
416
502
|
</div>
|
|
417
|
-
|
|
503
|
+
|
|
418
504
|
<!-- Debug Configuration -->
|
|
419
505
|
<div class="form-row">
|
|
420
506
|
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
421
507
|
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
422
508
|
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show saved image preview</label>
|
|
423
509
|
</div>
|
|
424
|
-
|
|
510
|
+
|
|
425
511
|
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
426
512
|
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
427
513
|
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
@@ -434,65 +520,108 @@
|
|
|
434
520
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
435
521
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
436
522
|
</div>
|
|
437
|
-
|
|
523
|
+
|
|
438
524
|
<hr>
|
|
439
|
-
|
|
440
|
-
<!--
|
|
525
|
+
|
|
526
|
+
<!-- Mode Selection -->
|
|
441
527
|
<div class="form-row">
|
|
442
|
-
<label for="node-input-
|
|
443
|
-
<
|
|
444
|
-
|
|
528
|
+
<label for="node-input-mode"><i class="fa fa-list"></i> Mode</label>
|
|
529
|
+
<select id="node-input-mode" style="width: 200px;">
|
|
530
|
+
<option value="single">Single image</option>
|
|
531
|
+
<option value="multiple">Multiple images</option>
|
|
532
|
+
</select>
|
|
445
533
|
</div>
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
<
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
534
|
+
|
|
535
|
+
<!-- Single Mode Fields -->
|
|
536
|
+
<div class="imageout-single-mode">
|
|
537
|
+
<div class="form-row">
|
|
538
|
+
<label for="node-input-folderPath"><i class="fa fa-folder"></i> Folder Path</label>
|
|
539
|
+
<input type="text" id="node-input-folderPath" style="width: 70%;" placeholder="/path/to/save/folder">
|
|
540
|
+
<input type="hidden" id="node-input-folderPathType">
|
|
453
541
|
</div>
|
|
454
|
-
</div>
|
|
455
542
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
543
|
+
<div class="form-row">
|
|
544
|
+
<label for="node-input-filenamePrefix"><i class="fa fa-tag"></i> Filename Prefix</label>
|
|
545
|
+
<input type="text" id="node-input-filenamePrefix" style="width: 70%;" placeholder="image (optional)">
|
|
546
|
+
<input type="hidden" id="node-input-filenamePrefixType">
|
|
547
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
548
|
+
Pattern: [prefix]_YYYYMMDD_HHMMSS.[ext]
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
|
|
552
|
+
<div class="form-row">
|
|
553
|
+
<label for="node-input-filenameFull"><i class="fa fa-file-text-o"></i> Full Filename</label>
|
|
554
|
+
<input type="text" id="node-input-filenameFull" style="width: 70%;" placeholder="photo.jpg (optional)">
|
|
555
|
+
<input type="hidden" id="node-input-filenameFullType">
|
|
556
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
557
|
+
Overrides prefix & timestamp when provided. Leave blank for automatic naming.
|
|
558
|
+
</div>
|
|
559
|
+
</div>
|
|
560
|
+
|
|
561
|
+
<hr>
|
|
562
|
+
|
|
563
|
+
<div class="form-row">
|
|
564
|
+
<label for="node-input-inputPath"><i class="fa fa-sign-in"></i> Input from</label>
|
|
565
|
+
<input type="text" id="node-input-inputPath" style="width: 70%;">
|
|
566
|
+
<input type="hidden" id="node-input-inputPathType">
|
|
462
567
|
</div>
|
|
463
568
|
</div>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
569
|
+
|
|
570
|
+
<!-- Multiple Mode Fields -->
|
|
571
|
+
<div class="imageout-multiple-mode" style="display: none;">
|
|
572
|
+
<div class="form-row">
|
|
573
|
+
<label for="node-input-saveConfig"><i class="fa fa-sign-in"></i> Input</label>
|
|
574
|
+
<input type="text" id="node-input-saveConfig" style="width: 70%;">
|
|
575
|
+
<input type="hidden" id="node-input-saveConfigType">
|
|
576
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
577
|
+
Array of objects, each containing an image and optional filename/folder.
|
|
578
|
+
</div>
|
|
579
|
+
</div>
|
|
580
|
+
|
|
581
|
+
<div class="form-row">
|
|
582
|
+
<label for="node-input-imageField"><i class="fa fa-picture-o"></i> Image field</label>
|
|
583
|
+
<input type="text" id="node-input-imageField" placeholder="bitmap" style="width: 200px;">
|
|
584
|
+
<div style="margin-left: 106px; margin-top: 4px; color: #666; font-size: 12px;">
|
|
585
|
+
Key name holding the image data in each object.
|
|
586
|
+
</div>
|
|
587
|
+
</div>
|
|
588
|
+
|
|
589
|
+
<div class="form-row">
|
|
590
|
+
<label for="node-input-outputDirField"><i class="fa fa-folder"></i> Output dir</label>
|
|
591
|
+
<input type="text" id="node-input-outputDirField" style="width: 70%;">
|
|
592
|
+
<input type="hidden" id="node-input-outputDirFieldType">
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div class="form-row">
|
|
596
|
+
<label for="node-input-filenameField"><i class="fa fa-file-text-o"></i> Filename</label>
|
|
597
|
+
<input type="text" id="node-input-filenameField" style="width: 70%;">
|
|
598
|
+
<input type="hidden" id="node-input-filenameFieldType">
|
|
599
|
+
</div>
|
|
472
600
|
</div>
|
|
473
|
-
|
|
601
|
+
|
|
474
602
|
<hr>
|
|
475
|
-
|
|
476
|
-
<!-- Output Format Configuration -->
|
|
603
|
+
|
|
604
|
+
<!-- Output Format Configuration (shared) -->
|
|
477
605
|
<div class="form-row">
|
|
478
606
|
<label for="node-input-outputFormat"><i class="fa fa-file-image-o"></i> Output Format</label>
|
|
479
607
|
<select id="node-input-outputFormat" style="width: 200px;">
|
|
480
608
|
<option value="jpg">JPEG</option>
|
|
481
609
|
<option value="png">PNG</option>
|
|
482
610
|
<option value="webp">WebP</option>
|
|
611
|
+
<option value="bmp">BMP</option>
|
|
483
612
|
</select>
|
|
484
613
|
</div>
|
|
485
|
-
|
|
614
|
+
|
|
486
615
|
<div class="form-row" id="quality-row">
|
|
487
616
|
<label for="node-input-outputQuality"><i class="fa fa-sliders"></i> Quality</label>
|
|
488
617
|
<input type="number" id="node-input-outputQuality" min="1" max="100" value="90" style="width: 70px;">
|
|
489
618
|
<span style="margin-left: 10px; color: #666;">1-100 (JPEG/WebP only)</span>
|
|
490
619
|
</div>
|
|
491
|
-
|
|
492
|
-
<div class="form-row" id="png-
|
|
493
|
-
<label for="node-input-
|
|
494
|
-
<input type="
|
|
495
|
-
<
|
|
620
|
+
|
|
621
|
+
<div class="form-row" id="png-compression-row" style="display: none;">
|
|
622
|
+
<label for="node-input-pngCompression"><i class="fa fa-leaf"></i> Compression</label>
|
|
623
|
+
<input type="number" id="node-input-pngCompression" min="0" max="9" step="1" style="width: 70px;">
|
|
624
|
+
<span style="margin-left: 10px; color: #666;">0-9 (higher = smaller file, slower)</span>
|
|
496
625
|
</div>
|
|
497
626
|
|
|
498
627
|
<div class="form-row" id="webp-lossless-row" style="display: none;">
|
|
@@ -512,10 +641,10 @@
|
|
|
512
641
|
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="4" style="width: 70px;">
|
|
513
642
|
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
514
643
|
</div>
|
|
515
|
-
|
|
644
|
+
|
|
516
645
|
<hr>
|
|
517
|
-
|
|
518
|
-
<!-- Protection Settings -->
|
|
646
|
+
|
|
647
|
+
<!-- Protection Settings (shared) -->
|
|
519
648
|
<div class="form-row">
|
|
520
649
|
<label for="node-input-overwriteProtection"><i class="fa fa-shield"></i> Protection</label>
|
|
521
650
|
<input type="checkbox" id="node-input-overwriteProtection" style="display:inline-block; width:auto; vertical-align:baseline;" checked>
|
|
@@ -528,14 +657,14 @@
|
|
|
528
657
|
<input type="hidden" id="node-input-maxImagesType">
|
|
529
658
|
<span style="margin-left: 10px; color: #666;">0 or blank keeps all files.</span>
|
|
530
659
|
</div>
|
|
531
|
-
|
|
660
|
+
|
|
532
661
|
<!-- Debug Configuration -->
|
|
533
662
|
<div class="form-row">
|
|
534
663
|
<label for="node-input-debugEnabled"><i class="fa fa-bug"></i> Debug</label>
|
|
535
664
|
<input type="checkbox" id="node-input-debugEnabled" style="display:inline-block; width:auto; vertical-align:baseline;">
|
|
536
665
|
<label for="node-input-debugEnabled" style="width:auto; margin-left:5px;">Show saved image preview</label>
|
|
537
666
|
</div>
|
|
538
|
-
|
|
667
|
+
|
|
539
668
|
<div class="form-row" id="debug-width-row" style="display: none;">
|
|
540
669
|
<label for="node-input-debugWidth"><i class="fa fa-arrows-h"></i> Debug Width</label>
|
|
541
670
|
<input type="text" id="node-input-debugWidth" style="width: 120px;">
|
|
@@ -545,156 +674,166 @@
|
|
|
545
674
|
|
|
546
675
|
<script type="text/x-red" data-help-name="rp-image-out">
|
|
547
676
|
<p>Saves images to the filesystem with automatic timestamp-based naming and optional overwrite protection.</p>
|
|
548
|
-
|
|
677
|
+
|
|
549
678
|
<h3>Details</h3>
|
|
550
679
|
<p>This node saves image data to disk with automatic timestamp naming to ensure unique filenames. It includes an enable/disable button (similar to the debug node) that allows you to control whether images are saved without modifying your flow.</p>
|
|
551
|
-
|
|
680
|
+
|
|
681
|
+
<h3>Mode</h3>
|
|
682
|
+
<dl class="message-properties">
|
|
683
|
+
<dt>Single image</dt>
|
|
684
|
+
<dd>Saves one image per message using the configured input path, folder, and filename settings.</dd>
|
|
685
|
+
<dt>Multiple images</dt>
|
|
686
|
+
<dd>Accepts an array of objects (e.g., from a batch pipeline). Each object contains an image and optionally a filename and output directory. Saves are processed sequentially to ensure correct overwrite protection and max-images enforcement.</dd>
|
|
687
|
+
</dl>
|
|
688
|
+
|
|
552
689
|
<h3>Properties</h3>
|
|
553
690
|
<dl class="message-properties">
|
|
554
691
|
<dt>Folder Path <span class="property-type">string | msg | flow | global</span></dt>
|
|
555
|
-
<dd>The directory where images will be saved.
|
|
556
|
-
|
|
692
|
+
<dd>(Single mode) The directory where images will be saved. Created automatically if missing.</dd>
|
|
693
|
+
|
|
557
694
|
<dt>Filename Prefix <span class="property-type">string | msg | flow | global | JSONata</span></dt>
|
|
558
|
-
<dd>Optional prefix for the auto-generated filename.
|
|
559
|
-
|
|
695
|
+
<dd>(Single mode) Optional prefix for the auto-generated filename. Defaults to <code>image</code>. Pattern: <code>[prefix]_YYYYMMDD_HHMMSS.[ext]</code>.</dd>
|
|
696
|
+
|
|
560
697
|
<dt>Full Filename <span class="property-type">string | msg | flow | global | JSONata</span></dt>
|
|
561
|
-
<dd>Overrides
|
|
562
|
-
|
|
563
|
-
<dt>Input from <span class="property-type">
|
|
564
|
-
<dd>
|
|
565
|
-
|
|
698
|
+
<dd>(Single mode) Overrides prefix & timestamp with an explicit name. If the extension is provided (jpg/png/webp/bmp), the output format adjusts accordingly.</dd>
|
|
699
|
+
|
|
700
|
+
<dt>Input from <span class="property-type">msg | flow | global</span></dt>
|
|
701
|
+
<dd>(Single mode) Location of the image data to save. Defaults to <code>msg.payload</code>.</dd>
|
|
702
|
+
|
|
703
|
+
<dt>Input <span class="property-type">msg | flow | global</span></dt>
|
|
704
|
+
<dd>(Multiple mode) Array of objects to iterate. Defaults to <code>msg.payload</code>.</dd>
|
|
705
|
+
|
|
706
|
+
<dt>Image field <span class="property-type">string</span></dt>
|
|
707
|
+
<dd>(Multiple mode) Key name in each object holding the image data. Defaults to <code>bitmap</code>.</dd>
|
|
708
|
+
|
|
709
|
+
<dt>Output dir <span class="property-type">item field | str | msg | flow | global</span></dt>
|
|
710
|
+
<dd>(Multiple mode) Per-item folder from a key in each object, or a shared value for all items. Defaults to reading <code>outputDir</code> from each item.</dd>
|
|
711
|
+
|
|
712
|
+
<dt>Filename <span class="property-type">item field | str | msg | flow | global</span></dt>
|
|
713
|
+
<dd>(Multiple mode) Per-item filename from a key in each object, or a shared value. When blank, a timestamped name is generated. Defaults to reading <code>filename</code> from each item.</dd>
|
|
714
|
+
|
|
566
715
|
<dt>Output Format <span class="property-type">select</span></dt>
|
|
567
|
-
<dd>
|
|
568
|
-
|
|
716
|
+
<dd>Image format: JPEG, PNG, WebP, or BMP.</dd>
|
|
717
|
+
|
|
569
718
|
<dt>Quality <span class="property-type">number</span></dt>
|
|
570
|
-
<dd>Quality
|
|
719
|
+
<dd>Quality for JPEG and WebP (1-100).</dd>
|
|
720
|
+
|
|
721
|
+
<dt>PNG Compression <span class="property-type">number</span></dt>
|
|
722
|
+
<dd>PNG compression level (0-9). Higher = smaller file, slower.</dd>
|
|
571
723
|
|
|
572
724
|
<dt>WebP Lossless <span class="property-type">boolean</span></dt>
|
|
573
|
-
<dd>
|
|
725
|
+
<dd>Lossless WebP encoding (ignores quality slider).</dd>
|
|
574
726
|
|
|
575
727
|
<dt>WebP Effort <span class="property-type">number</span></dt>
|
|
576
|
-
<dd>
|
|
728
|
+
<dd>Encoder effort 0-6 for WebP.</dd>
|
|
577
729
|
|
|
578
730
|
<dt>WebP Smart Subsample <span class="property-type">boolean</span></dt>
|
|
579
|
-
<dd>
|
|
580
|
-
|
|
581
|
-
<dt>PNG Optimize <span class="property-type">boolean</span></dt>
|
|
582
|
-
<dd>When enabled, applies maximum compression to PNG files. This creates smaller files but takes more processing time.</dd>
|
|
583
|
-
|
|
731
|
+
<dd>Smarter chroma downsampling for lossy WebP.</dd>
|
|
732
|
+
|
|
584
733
|
<dt>Overwrite Protection <span class="property-type">boolean</span></dt>
|
|
585
|
-
<dd>
|
|
734
|
+
<dd>Appends <code>_2</code>, <code>_3</code>, etc. if a file already exists.</dd>
|
|
735
|
+
|
|
736
|
+
<dt>Max Images <span class="property-type">number | msg | flow | global</span></dt>
|
|
737
|
+
<dd>FIFO retention: deletes oldest files to keep at most this many.</dd>
|
|
586
738
|
|
|
587
|
-
<dt>Max Images <span class="property-type">number | msg | flow | global | JSONata</span></dt>
|
|
588
|
-
<dd>Optional FIFO retention policy for the target folder. When greater than zero, the node deletes the oldest files after saving to keep at most the specified number of images.</dd>
|
|
589
|
-
|
|
590
739
|
<dt>Active Button <span class="property-type">button</span></dt>
|
|
591
|
-
<dd>
|
|
740
|
+
<dd>Enable/disable saving without modifying the flow.</dd>
|
|
592
741
|
</dl>
|
|
593
|
-
|
|
742
|
+
|
|
594
743
|
<h3>Inputs</h3>
|
|
595
744
|
<dl class="message-properties">
|
|
596
745
|
<dt>Image Object <span class="property-type">object</span></dt>
|
|
597
|
-
<dd>Standard image structure with properties: data (Buffer), width, height, channels, colorSpace, dtype.</dd>
|
|
746
|
+
<dd>Standard image structure with properties: data (Buffer), width, height, channels, colorSpace, dtype. Or an encoded Buffer (JPEG/PNG/WebP).</dd>
|
|
598
747
|
</dl>
|
|
599
|
-
|
|
600
|
-
<h3>Outputs</h3>
|
|
601
|
-
<p>This node has no outputs. It is a terminal node that saves images to the filesystem.</p>
|
|
602
|
-
|
|
603
|
-
<h3>Examples</h3>
|
|
604
|
-
<ul>
|
|
605
|
-
<li><strong>Basic Save:</strong> Connect to any image processing node output to save the result with timestamp naming.</li>
|
|
606
|
-
<li><strong>Dynamic Folder:</strong> Set folder path from <code>msg.folder</code> to save to different locations based on message content.</li>
|
|
607
|
-
<li><strong>With Prefix:</strong> Use prefix "webcam" to generate files like: <code>webcam_20240109_143022.jpg</code></li>
|
|
608
|
-
<li><strong>Overwrite Protection:</strong> If <code>image_20240109_143022.jpg</code> exists, saves as <code>image_20240109_143022_2.jpg</code></li>
|
|
609
|
-
<li><strong>Conditional Saving:</strong> Use the button to enable/disable saving during development or testing.</li>
|
|
610
|
-
</ul>
|
|
611
|
-
|
|
748
|
+
|
|
612
749
|
<h3>Status Indicators</h3>
|
|
613
750
|
<ul>
|
|
614
751
|
<li><strong>Gray dot "inactive":</strong> Node is disabled via button</li>
|
|
615
|
-
<li><strong>Blue dot "saving...":</strong> Currently writing file to disk</li>
|
|
616
|
-
<li><strong>Green dot "saved:
|
|
617
|
-
<li><strong>Red dot "Error":</strong> Save failed (check debug panel
|
|
752
|
+
<li><strong>Blue dot "saving...":</strong> Currently writing file(s) to disk</li>
|
|
753
|
+
<li><strong>Green dot "saved: ...":</strong> Successfully saved (shows filename or count)</li>
|
|
754
|
+
<li><strong>Red dot "Error":</strong> Save failed (check debug panel)</li>
|
|
618
755
|
</ul>
|
|
619
|
-
|
|
620
|
-
<h3>Performance</h3>
|
|
621
|
-
<p>Image encoding and file writing are performed asynchronously for optimal performance. The node status displays the save time in milliseconds.</p>
|
|
622
756
|
</script>
|
|
623
757
|
|
|
624
758
|
<script type="text/x-red" data-help-name="image-out">
|
|
625
759
|
<p>Saves images to the filesystem with automatic timestamp-based naming and optional overwrite protection.</p>
|
|
626
|
-
|
|
760
|
+
|
|
627
761
|
<h3>Details</h3>
|
|
628
762
|
<p>This node saves image data to disk with automatic timestamp naming to ensure unique filenames. It includes an enable/disable button (similar to the debug node) that allows you to control whether images are saved without modifying your flow.</p>
|
|
629
|
-
|
|
763
|
+
|
|
764
|
+
<h3>Mode</h3>
|
|
765
|
+
<dl class="message-properties">
|
|
766
|
+
<dt>Single image</dt>
|
|
767
|
+
<dd>Saves one image per message using the configured input path, folder, and filename settings.</dd>
|
|
768
|
+
<dt>Multiple images</dt>
|
|
769
|
+
<dd>Accepts an array of objects (e.g., from a batch pipeline). Each object contains an image and optionally a filename and output directory. Saves are processed sequentially to ensure correct overwrite protection and max-images enforcement.</dd>
|
|
770
|
+
</dl>
|
|
771
|
+
|
|
630
772
|
<h3>Properties</h3>
|
|
631
773
|
<dl class="message-properties">
|
|
632
774
|
<dt>Folder Path <span class="property-type">string | msg | flow | global</span></dt>
|
|
633
|
-
<dd>The directory where images will be saved.
|
|
634
|
-
|
|
775
|
+
<dd>(Single mode) The directory where images will be saved. Created automatically if missing.</dd>
|
|
776
|
+
|
|
635
777
|
<dt>Filename Prefix <span class="property-type">string | msg | flow | global | JSONata</span></dt>
|
|
636
|
-
<dd>Optional prefix for the auto-generated filename.
|
|
637
|
-
|
|
778
|
+
<dd>(Single mode) Optional prefix for the auto-generated filename. Defaults to <code>image</code>. Pattern: <code>[prefix]_YYYYMMDD_HHMMSS.[ext]</code>.</dd>
|
|
779
|
+
|
|
638
780
|
<dt>Full Filename <span class="property-type">string | msg | flow | global | JSONata</span></dt>
|
|
639
|
-
<dd>Overrides
|
|
640
|
-
|
|
641
|
-
<dt>Input from <span class="property-type">
|
|
642
|
-
<dd>
|
|
643
|
-
|
|
781
|
+
<dd>(Single mode) Overrides prefix & timestamp with an explicit name. If the extension is provided (jpg/png/webp/bmp), the output format adjusts accordingly.</dd>
|
|
782
|
+
|
|
783
|
+
<dt>Input from <span class="property-type">msg | flow | global</span></dt>
|
|
784
|
+
<dd>(Single mode) Location of the image data to save. Defaults to <code>msg.payload</code>.</dd>
|
|
785
|
+
|
|
786
|
+
<dt>Input <span class="property-type">msg | flow | global</span></dt>
|
|
787
|
+
<dd>(Multiple mode) Array of objects to iterate. Defaults to <code>msg.payload</code>.</dd>
|
|
788
|
+
|
|
789
|
+
<dt>Image field <span class="property-type">string</span></dt>
|
|
790
|
+
<dd>(Multiple mode) Key name in each object holding the image data. Defaults to <code>bitmap</code>.</dd>
|
|
791
|
+
|
|
792
|
+
<dt>Output dir <span class="property-type">item field | str | msg | flow | global</span></dt>
|
|
793
|
+
<dd>(Multiple mode) Per-item folder from a key in each object, or a shared value for all items. Defaults to reading <code>outputDir</code> from each item.</dd>
|
|
794
|
+
|
|
795
|
+
<dt>Filename <span class="property-type">item field | str | msg | flow | global</span></dt>
|
|
796
|
+
<dd>(Multiple mode) Per-item filename from a key in each object, or a shared value. When blank, a timestamped name is generated. Defaults to reading <code>filename</code> from each item.</dd>
|
|
797
|
+
|
|
644
798
|
<dt>Output Format <span class="property-type">select</span></dt>
|
|
645
|
-
<dd>
|
|
646
|
-
|
|
799
|
+
<dd>Image format: JPEG, PNG, WebP, or BMP.</dd>
|
|
800
|
+
|
|
647
801
|
<dt>Quality <span class="property-type">number</span></dt>
|
|
648
|
-
<dd>Quality
|
|
802
|
+
<dd>Quality for JPEG and WebP (1-100).</dd>
|
|
803
|
+
|
|
804
|
+
<dt>PNG Compression <span class="property-type">number</span></dt>
|
|
805
|
+
<dd>PNG compression level (0-9). Higher = smaller file, slower.</dd>
|
|
649
806
|
|
|
650
807
|
<dt>WebP Lossless <span class="property-type">boolean</span></dt>
|
|
651
|
-
<dd>
|
|
808
|
+
<dd>Lossless WebP encoding (ignores quality slider).</dd>
|
|
652
809
|
|
|
653
810
|
<dt>WebP Effort <span class="property-type">number</span></dt>
|
|
654
|
-
<dd>
|
|
811
|
+
<dd>Encoder effort 0-6 for WebP.</dd>
|
|
655
812
|
|
|
656
813
|
<dt>WebP Smart Subsample <span class="property-type">boolean</span></dt>
|
|
657
|
-
<dd>
|
|
658
|
-
|
|
659
|
-
<dt>PNG Optimize <span class="property-type">boolean</span></dt>
|
|
660
|
-
<dd>When enabled, applies maximum compression to PNG files. This creates smaller files but takes more processing time.</dd>
|
|
661
|
-
|
|
814
|
+
<dd>Smarter chroma downsampling for lossy WebP.</dd>
|
|
815
|
+
|
|
662
816
|
<dt>Overwrite Protection <span class="property-type">boolean</span></dt>
|
|
663
|
-
<dd>
|
|
817
|
+
<dd>Appends <code>_2</code>, <code>_3</code>, etc. if a file already exists.</dd>
|
|
818
|
+
|
|
819
|
+
<dt>Max Images <span class="property-type">number | msg | flow | global</span></dt>
|
|
820
|
+
<dd>FIFO retention: deletes oldest files to keep at most this many.</dd>
|
|
664
821
|
|
|
665
|
-
<dt>Max Images <span class="property-type">number | msg | flow | global | JSONata</span></dt>
|
|
666
|
-
<dd>Optional FIFO retention policy for the target folder. When greater than zero, the node deletes the oldest files after saving to keep at most the specified number of images.</dd>
|
|
667
|
-
|
|
668
822
|
<dt>Active Button <span class="property-type">button</span></dt>
|
|
669
|
-
<dd>
|
|
823
|
+
<dd>Enable/disable saving without modifying the flow.</dd>
|
|
670
824
|
</dl>
|
|
671
|
-
|
|
825
|
+
|
|
672
826
|
<h3>Inputs</h3>
|
|
673
827
|
<dl class="message-properties">
|
|
674
828
|
<dt>Image Object <span class="property-type">object</span></dt>
|
|
675
|
-
<dd>Standard image structure with properties: data (Buffer), width, height, channels, colorSpace, dtype.</dd>
|
|
829
|
+
<dd>Standard image structure with properties: data (Buffer), width, height, channels, colorSpace, dtype. Or an encoded Buffer (JPEG/PNG/WebP).</dd>
|
|
676
830
|
</dl>
|
|
677
|
-
|
|
678
|
-
<h3>Outputs</h3>
|
|
679
|
-
<p>This node has no outputs. It is a terminal node that saves images to the filesystem.</p>
|
|
680
|
-
|
|
681
|
-
<h3>Examples</h3>
|
|
682
|
-
<ul>
|
|
683
|
-
<li><strong>Basic Save:</strong> Connect to any image processing node output to save the result with timestamp naming.</li>
|
|
684
|
-
<li><strong>Dynamic Folder:</strong> Set folder path from <code>msg.folder</code> to save to different locations based on message content.</li>
|
|
685
|
-
<li><strong>With Prefix:</strong> Use prefix "webcam" to generate files like: <code>webcam_20240109_143022.jpg</code></li>
|
|
686
|
-
<li><strong>Overwrite Protection:</strong> If <code>image_20240109_143022.jpg</code> exists, saves as <code>image_20240109_143022_2.jpg</code></li>
|
|
687
|
-
<li><strong>Conditional Saving:</strong> Use the button to enable/disable saving during development or testing.</li>
|
|
688
|
-
</ul>
|
|
689
|
-
|
|
831
|
+
|
|
690
832
|
<h3>Status Indicators</h3>
|
|
691
833
|
<ul>
|
|
692
834
|
<li><strong>Gray dot "inactive":</strong> Node is disabled via button</li>
|
|
693
|
-
<li><strong>Blue dot "saving...":</strong> Currently writing file to disk</li>
|
|
694
|
-
<li><strong>Green dot "saved:
|
|
695
|
-
<li><strong>Red dot "Error":</strong> Save failed (check debug panel
|
|
835
|
+
<li><strong>Blue dot "saving...":</strong> Currently writing file(s) to disk</li>
|
|
836
|
+
<li><strong>Green dot "saved: ...":</strong> Successfully saved (shows filename or count)</li>
|
|
837
|
+
<li><strong>Red dot "Error":</strong> Save failed (check debug panel)</li>
|
|
696
838
|
</ul>
|
|
697
|
-
|
|
698
|
-
<h3>Performance</h3>
|
|
699
|
-
<p>Image encoding and file writing are performed asynchronously for optimal performance. The node status displays the save time in milliseconds.</p>
|
|
700
839
|
</script>
|