@rosepetal/node-red-contrib-image-tools 1.5.1 → 1.5.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/.claude/CLAUDE.md +33 -0
- package/.claude/agents/doc-env-validator.md +136 -0
- package/.claude/agents/doc-reviewer.md +78 -0
- package/.claude/agents/doc-writer.md +67 -0
- package/.claude/agents/gif-recorder.md +143 -0
- package/.claude/rules/claude-code-conventions.md +58 -0
- package/.claude/rules/documentation-conventions.md +136 -0
- package/.claude/rules/node-implementation-template.md +125 -0
- package/.claude/scripts/announce-orphans.sh +70 -0
- package/.claude/skills/doctor/SKILL.md +37 -0
- package/.claude/skills/document-all-nodes/SKILL.md +48 -0
- package/.claude/skills/document-node/SKILL.md +131 -0
- package/.claude/skills/document-node/prompts/synthesize-help.md +33 -0
- package/.claude/skills/document-node/prompts/synthesize-md.md +48 -0
- package/.claude/skills/document-node/templates/help-block.html.tmpl +34 -0
- package/.claude/skills/document-node/templates/node-doc.md.tmpl +43 -0
- package/.github/workflows/build-prebuild.yml +22 -2
- package/artifacts/darwin-arm64/package.json +1 -1
- package/artifacts/linux-arm64/package.json +1 -1
- package/artifacts/linux-x64/package.json +1 -1
- package/artifacts/linuxmusl-x64/package.json +1 -1
- package/node-red-contrib-image-tools/nodes/io/image-out.html +6 -6
- package/node-red-contrib-image-tools/nodes/transform/filter.html +22 -28
- package/node-red-contrib-image-tools/nodes/transform/filter.js +18 -2
- package/npm/darwin-arm64/package.json +1 -1
- package/npm/darwin-x64/package.json +1 -1
- package/npm/linux-arm64/package.json +1 -1
- package/npm/linux-x64/package.json +1 -1
- package/npm/linuxmusl-x64/package.json +1 -1
- package/npm/win32-x64/package.json +1 -1
- package/package.json +8 -7
- package/rosepetal-image-engine/src/utils.h +5 -1
- package/scripts/sync-version.js +109 -0
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
outputQuality: { value: 90 },
|
|
25
25
|
pngCompression: { value: 8 },
|
|
26
26
|
webpLossless: { value: false },
|
|
27
|
-
webpEffort: { value:
|
|
27
|
+
webpEffort: { value: 0 },
|
|
28
28
|
webpSmartSubsample: { value: false },
|
|
29
29
|
overwriteProtection: { value: true },
|
|
30
30
|
maxImages: { value: "" },
|
|
31
31
|
maxImagesType: { value: "num" },
|
|
32
|
-
diskThreshold: { value:
|
|
32
|
+
diskThreshold: { value: 95 },
|
|
33
33
|
active: { value: true },
|
|
34
34
|
debugEnabled: { value: false },
|
|
35
35
|
debugWidth: { value: 200 },
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
|
|
483
483
|
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
484
484
|
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> WebP Effort</label>
|
|
485
|
-
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="
|
|
485
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="0" style="width: 70px;">
|
|
486
486
|
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
487
487
|
</div>
|
|
488
488
|
|
|
@@ -645,7 +645,7 @@
|
|
|
645
645
|
|
|
646
646
|
<div class="form-row" id="webp-effort-row" style="display: none;">
|
|
647
647
|
<label for="node-input-webpEffort"><i class="fa fa-tachometer"></i> WebP Effort</label>
|
|
648
|
-
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="
|
|
648
|
+
<input type="number" id="node-input-webpEffort" min="0" max="6" placeholder="0" style="width: 70px;">
|
|
649
649
|
<span style="margin-left: 10px; color: #666;">0-6 (higher = smaller file, slower)</span>
|
|
650
650
|
</div>
|
|
651
651
|
|
|
@@ -750,7 +750,7 @@
|
|
|
750
750
|
<dd>FIFO retention: deletes oldest files to keep at most this many.</dd>
|
|
751
751
|
|
|
752
752
|
<dt>Disk Limit <span class="property-type">number</span></dt>
|
|
753
|
-
<dd>Percentage of disk usage above which saving is skipped (default
|
|
753
|
+
<dd>Percentage of disk usage above which saving is skipped (default 95). Set to 0 to disable the check.</dd>
|
|
754
754
|
|
|
755
755
|
<dt>Active Button <span class="property-type">button</span></dt>
|
|
756
756
|
<dd>Enable/disable saving without modifying the flow.</dd>
|
|
@@ -836,7 +836,7 @@
|
|
|
836
836
|
<dd>FIFO retention: deletes oldest files to keep at most this many.</dd>
|
|
837
837
|
|
|
838
838
|
<dt>Disk Limit <span class="property-type">number</span></dt>
|
|
839
|
-
<dd>Percentage of disk usage above which saving is skipped (default
|
|
839
|
+
<dd>Percentage of disk usage above which saving is skipped (default 95). Set to 0 to disable the check.</dd>
|
|
840
840
|
|
|
841
841
|
<dt>Active Button <span class="property-type">button</span></dt>
|
|
842
842
|
<dd>Enable/disable saving without modifying the flow.</dd>
|
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
// Otsu-specific
|
|
29
29
|
otsuInvert: { value: false },
|
|
30
30
|
otsuPreBlur: { value: 0 },
|
|
31
|
+
otsuPreBlurType: { value: "num" },
|
|
31
32
|
// Histogram EQ-specific
|
|
32
|
-
histEqStrength: { value: 100 }
|
|
33
|
+
histEqStrength: { value: 100 },
|
|
34
|
+
histEqStrengthType: { value: "num" }
|
|
33
35
|
},
|
|
34
36
|
inputs: 1,
|
|
35
37
|
outputs: 1,
|
|
@@ -63,25 +65,17 @@
|
|
|
63
65
|
typeField: "#node-input-intensityType"
|
|
64
66
|
});
|
|
65
67
|
|
|
66
|
-
// ===
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// Histogram EQ strength display
|
|
78
|
-
var $histEqStrength = $("#node-input-histEqStrength");
|
|
79
|
-
var $histEqValue = $("#histeq-strength-value");
|
|
80
|
-
function updateHistEqDisplay() {
|
|
81
|
-
$histEqValue.text(parseInt($histEqStrength.val()) + "%");
|
|
82
|
-
}
|
|
83
|
-
$histEqStrength.on("input", updateHistEqDisplay);
|
|
84
|
-
updateHistEqDisplay();
|
|
68
|
+
// === Otsu / Histogram EQ TypedInputs (dynamic values) ===
|
|
69
|
+
$("#node-input-otsuPreBlur").typedInput({
|
|
70
|
+
default: 'num',
|
|
71
|
+
types: ['num', 'msg', 'flow', 'global'],
|
|
72
|
+
typeField: "#node-input-otsuPreBlurType"
|
|
73
|
+
});
|
|
74
|
+
$("#node-input-histEqStrength").typedInput({
|
|
75
|
+
default: 'num',
|
|
76
|
+
types: ['num', 'msg', 'flow', 'global'],
|
|
77
|
+
typeField: "#node-input-histEqStrengthType"
|
|
78
|
+
});
|
|
85
79
|
|
|
86
80
|
function updateFilterParameters() {
|
|
87
81
|
const filterType = $("#node-input-filterType").val();
|
|
@@ -414,8 +408,8 @@
|
|
|
414
408
|
</div>
|
|
415
409
|
<div class="form-row">
|
|
416
410
|
<label for="node-input-otsuPreBlur"><i class="fa fa-circle-o"></i> Pre-blur</label>
|
|
417
|
-
<input type="
|
|
418
|
-
<
|
|
411
|
+
<input type="text" id="node-input-otsuPreBlur" style="width: 70%;" placeholder="0 = off, odd 3-15">
|
|
412
|
+
<input type="hidden" id="node-input-otsuPreBlurType">
|
|
419
413
|
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
420
414
|
Gaussian blur before thresholding to reduce noise (0 = off, odd values 3-15)
|
|
421
415
|
</div>
|
|
@@ -426,8 +420,8 @@
|
|
|
426
420
|
<div id="histeq-params" style="display: none;">
|
|
427
421
|
<div class="form-row">
|
|
428
422
|
<label for="node-input-histEqStrength"><i class="fa fa-sliders"></i> Strength</label>
|
|
429
|
-
<input type="
|
|
430
|
-
<
|
|
423
|
+
<input type="text" id="node-input-histEqStrength" style="width: 70%;" placeholder="0-100">
|
|
424
|
+
<input type="hidden" id="node-input-histEqStrengthType">
|
|
431
425
|
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
432
426
|
Blend between original (0%) and fully equalized (100%)
|
|
433
427
|
</div>
|
|
@@ -549,8 +543,8 @@
|
|
|
549
543
|
</div>
|
|
550
544
|
<div class="form-row">
|
|
551
545
|
<label for="node-input-otsuPreBlur"><i class="fa fa-circle-o"></i> Pre-blur</label>
|
|
552
|
-
<input type="
|
|
553
|
-
<
|
|
546
|
+
<input type="text" id="node-input-otsuPreBlur" style="width: 70%;" placeholder="0 = off, odd 3-15">
|
|
547
|
+
<input type="hidden" id="node-input-otsuPreBlurType">
|
|
554
548
|
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
555
549
|
Gaussian blur before thresholding to reduce noise (0 = off, odd values 3-15)
|
|
556
550
|
</div>
|
|
@@ -561,8 +555,8 @@
|
|
|
561
555
|
<div id="histeq-params" style="display: none;">
|
|
562
556
|
<div class="form-row">
|
|
563
557
|
<label for="node-input-histEqStrength"><i class="fa fa-sliders"></i> Strength</label>
|
|
564
|
-
<input type="
|
|
565
|
-
<
|
|
558
|
+
<input type="text" id="node-input-histEqStrength" style="width: 70%;" placeholder="0-100">
|
|
559
|
+
<input type="hidden" id="node-input-histEqStrengthType">
|
|
566
560
|
<div style="margin-top: 5px; font-size: 10px; color: #999;">
|
|
567
561
|
Blend between original (0%) and fully equalized (100%)
|
|
568
562
|
</div>
|
|
@@ -68,13 +68,29 @@ module.exports = function (RED) {
|
|
|
68
68
|
|
|
69
69
|
// Override parameters for filter types with their own config
|
|
70
70
|
if (filterType === 'otsu') {
|
|
71
|
-
|
|
71
|
+
const preBlurResolved = NodeUtils.resolveDimension(
|
|
72
|
+
node,
|
|
73
|
+
config.otsuPreBlurType || 'num',
|
|
74
|
+
config.otsuPreBlur,
|
|
75
|
+
msg
|
|
76
|
+
);
|
|
77
|
+
let preBlur = parseInt(preBlurResolved);
|
|
78
|
+
if (!Number.isFinite(preBlur)) preBlur = 0;
|
|
79
|
+
kernelSize = Math.max(0, Math.min(preBlur, 15));
|
|
72
80
|
if (kernelSize > 0 && kernelSize < 3) kernelSize = 3;
|
|
73
81
|
if (kernelSize > 0 && kernelSize % 2 === 0) kernelSize++;
|
|
74
82
|
intensity = config.otsuInvert ? 1.0 : 0.0;
|
|
75
83
|
} else if (filterType === 'histogram_eq') {
|
|
76
84
|
kernelSize = 3; // unused but must be valid
|
|
77
|
-
|
|
85
|
+
const strengthResolved = NodeUtils.resolveDimension(
|
|
86
|
+
node,
|
|
87
|
+
config.histEqStrengthType || 'num',
|
|
88
|
+
config.histEqStrength,
|
|
89
|
+
msg
|
|
90
|
+
);
|
|
91
|
+
let strength = parseInt(strengthResolved);
|
|
92
|
+
if (!Number.isFinite(strength)) strength = 100;
|
|
93
|
+
intensity = Math.max(0.0, Math.min(strength / 100.0, 1.0));
|
|
78
94
|
} else {
|
|
79
95
|
// Standard filters: validate parameters
|
|
80
96
|
kernelSize = Math.max(3, Math.min(kernelSize, 15));
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rosepetal/node-red-contrib-image-tools",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Node-RED Image Processing Toolkit",
|
|
5
5
|
"main": "install.sh",
|
|
6
6
|
"directories": {
|
|
7
7
|
"doc": "docs"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"sync-version": "node scripts/sync-version.js"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -35,11 +36,11 @@
|
|
|
35
36
|
"sharp": "^0.34.2"
|
|
36
37
|
},
|
|
37
38
|
"optionalDependencies": {
|
|
38
|
-
"@rosepetal/node-red-contrib-image-tools-linux-x64": "1.5.
|
|
39
|
-
"@rosepetal/node-red-contrib-image-tools-linux-arm64": "1.5.
|
|
40
|
-
"@rosepetal/node-red-contrib-image-tools-linuxmusl-x64": "1.5.
|
|
41
|
-
"@rosepetal/node-red-contrib-image-tools-darwin-x64": "1.5.
|
|
42
|
-
"@rosepetal/node-red-contrib-image-tools-darwin-arm64": "1.5.
|
|
39
|
+
"@rosepetal/node-red-contrib-image-tools-linux-x64": "1.5.3",
|
|
40
|
+
"@rosepetal/node-red-contrib-image-tools-linux-arm64": "1.5.3",
|
|
41
|
+
"@rosepetal/node-red-contrib-image-tools-linuxmusl-x64": "1.5.3",
|
|
42
|
+
"@rosepetal/node-red-contrib-image-tools-darwin-x64": "1.5.3",
|
|
43
|
+
"@rosepetal/node-red-contrib-image-tools-darwin-arm64": "1.5.3"
|
|
43
44
|
},
|
|
44
45
|
"node-red": {
|
|
45
46
|
"version": ">=1.0.0",
|
|
@@ -107,7 +107,11 @@ inline cv::Mat ConvertToMat(const Napi::Value& input) {
|
|
|
107
107
|
if (img.empty()) {
|
|
108
108
|
throw Napi::Error::New(env, "Failed to decode image buffer.");
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
// imdecode returns BGR/BGRA regardless of file format, assume input is RGB/RGBA
|
|
112
|
+
if (img.channels() == 3) cv::cvtColor(img, img, cv::COLOR_BGR2RGB);
|
|
113
|
+
else if (img.channels() == 4) cv::cvtColor(img, img, cv::COLOR_BGRA2RGBA);
|
|
114
|
+
return img; // RGB/RGBA/GRAY, matching the colorSpace labels nodes assign
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
throw Napi::Error::New(env,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Version sync (CI + local use)
|
|
4
|
+
*
|
|
5
|
+
* Stamps a single version across every PUBLISHED package.json so a release
|
|
6
|
+
* only needs ONE source of truth — the git tag. No more hand-editing.
|
|
7
|
+
*
|
|
8
|
+
* Updates:
|
|
9
|
+
* - package.json (root) → "version"
|
|
10
|
+
* - package.json (root) → every "@rosepetal/node-red-contrib-image-tools-*"
|
|
11
|
+
* pin under optionalDependencies (must match exactly,
|
|
12
|
+
* or npm resolves the wrong / missing prebuilt binary)
|
|
13
|
+
* - npm/<arch>/package.json → "version" (all platform packages)
|
|
14
|
+
*
|
|
15
|
+
* Does NOT touch rosepetal-image-engine/package.json (private: true, internal build).
|
|
16
|
+
*
|
|
17
|
+
* Version source (priority order):
|
|
18
|
+
* 1. CLI arg: node scripts/sync-version.js 1.6.0
|
|
19
|
+
* 2. env GITHUB_REF tag: refs/tags/v1.6.0 → 1.6.0 (how CI passes it)
|
|
20
|
+
* 3. fallback: current root "version" (idempotent re-stamp)
|
|
21
|
+
*
|
|
22
|
+
* Edits are surgical (regex on the version string only) so unrelated formatting
|
|
23
|
+
* stays byte-for-byte identical — running it twice with the same version is a no-op.
|
|
24
|
+
*
|
|
25
|
+
* Usage: node scripts/sync-version.js [version] [--dry-run]
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const fs = require('fs');
|
|
29
|
+
const path = require('path');
|
|
30
|
+
|
|
31
|
+
const ROOT = path.join(__dirname, '..');
|
|
32
|
+
const DRY_RUN = process.argv.includes('--dry-run');
|
|
33
|
+
const PLATFORM_PREFIX = '@rosepetal/node-red-contrib-image-tools-';
|
|
34
|
+
const SEMVER = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)*$/;
|
|
35
|
+
|
|
36
|
+
function escapeRegex(str) {
|
|
37
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Resolve the target version from CLI arg, the git tag, or the current root value.
|
|
41
|
+
function resolveVersion() {
|
|
42
|
+
const arg = process.argv.slice(2).find((a) => !a.startsWith('-'));
|
|
43
|
+
if (arg) return arg.replace(/^v/, '');
|
|
44
|
+
|
|
45
|
+
const tag = (process.env.GITHUB_REF || '').match(/^refs\/tags\/v?(.+)$/);
|
|
46
|
+
if (tag) return tag[1];
|
|
47
|
+
|
|
48
|
+
return require(path.join(ROOT, 'package.json')).version;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Replace the FIRST top-level "version": "<digit...>". The leading-digit guard
|
|
52
|
+
// skips node-red's "version": ">=1.0.0" (and any other range-style field).
|
|
53
|
+
function setTopLevelVersion(content, version) {
|
|
54
|
+
return content.replace(/("version":\s*")\d[^"]*(")/, `$1${version}$2`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Replace the value of a specific dependency key (e.g. an optionalDependencies pin).
|
|
58
|
+
function setDepVersion(content, dep, version) {
|
|
59
|
+
const re = new RegExp(`("${escapeRegex(dep)}":\\s*")[^"]*(")`);
|
|
60
|
+
return content.replace(re, `$1${version}$2`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ─────────────────────────────────────────────────────────────
|
|
64
|
+
// Main
|
|
65
|
+
// ─────────────────────────────────────────────────────────────
|
|
66
|
+
|
|
67
|
+
const version = resolveVersion();
|
|
68
|
+
if (!SEMVER.test(version)) {
|
|
69
|
+
console.error(`✗ "${version}" is not a valid semver version`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log(`=== Sync version → ${version} ===`);
|
|
74
|
+
if (DRY_RUN) console.log('(dry run — no files written)\n');
|
|
75
|
+
else console.log('');
|
|
76
|
+
|
|
77
|
+
let count = 0;
|
|
78
|
+
|
|
79
|
+
function applyEdit(absFile, label, transform) {
|
|
80
|
+
const before = fs.readFileSync(absFile, 'utf8');
|
|
81
|
+
const after = transform(before);
|
|
82
|
+
if (!DRY_RUN) fs.writeFileSync(absFile, after);
|
|
83
|
+
const changed = after !== before;
|
|
84
|
+
console.log(` ${changed ? '✓' : '·'} ${label}${changed ? '' : ' (already current)'}`);
|
|
85
|
+
count++;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 1. root package.json: version + every platform pin in optionalDependencies
|
|
89
|
+
const rootFile = path.join(ROOT, 'package.json');
|
|
90
|
+
const rootPkg = JSON.parse(fs.readFileSync(rootFile, 'utf8'));
|
|
91
|
+
const pins = Object.keys(rootPkg.optionalDependencies || {}).filter((d) =>
|
|
92
|
+
d.startsWith(PLATFORM_PREFIX),
|
|
93
|
+
);
|
|
94
|
+
applyEdit(rootFile, `package.json (version + ${pins.length} optionalDependencies)`, (content) => {
|
|
95
|
+
content = setTopLevelVersion(content, version);
|
|
96
|
+
for (const dep of pins) content = setDepVersion(content, dep, version);
|
|
97
|
+
return content;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// 2. every npm/<arch>/package.json
|
|
101
|
+
const npmDir = path.join(ROOT, 'npm');
|
|
102
|
+
for (const arch of fs.readdirSync(npmDir).sort()) {
|
|
103
|
+
const file = path.join(npmDir, arch, 'package.json');
|
|
104
|
+
if (!fs.existsSync(file)) continue;
|
|
105
|
+
applyEdit(file, `npm/${arch}/package.json`, (content) => setTopLevelVersion(content, version));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log(`\nDone — ${count} package.json file(s) at ${version}.`);
|
|
109
|
+
if (DRY_RUN) console.log('(dry run — re-run without --dry-run to apply.)');
|