@lee-jisoo/n8n-nodes-mediafx 1.6.22 → 1.6.24
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/README.md
CHANGED
|
@@ -10,6 +10,14 @@ This is a custom n8n node for comprehensive, local media processing using FFmpeg
|
|
|
10
10
|
|
|
11
11
|
## 🆕 What's New in This Fork
|
|
12
12
|
|
|
13
|
+
### v1.6.24
|
|
14
|
+
**Bug Fixes**
|
|
15
|
+
|
|
16
|
+
- **🐛 Add Text to Image Fix**: Fixed "Unable to find a suitable output format" error
|
|
17
|
+
- Issue occurred when input image was downloaded from URL without file extension
|
|
18
|
+
- Now automatically detects actual image format using ffprobe
|
|
19
|
+
- Properly outputs correct format (JPEG, PNG, etc.) regardless of input file extension
|
|
20
|
+
|
|
13
21
|
### v1.6.21
|
|
14
22
|
**New Features**
|
|
15
23
|
|
|
@@ -29,6 +29,29 @@ const path = __importStar(require("path"));
|
|
|
29
29
|
const ffmpeg = require("fluent-ffmpeg");
|
|
30
30
|
const utils_1 = require("../utils");
|
|
31
31
|
const fs = __importStar(require("fs-extra"));
|
|
32
|
+
// Map FFmpeg format names to file extensions
|
|
33
|
+
const FORMAT_TO_EXTENSION = {
|
|
34
|
+
'jpeg_pipe': '.jpg',
|
|
35
|
+
'png_pipe': '.png',
|
|
36
|
+
'gif_pipe': '.gif',
|
|
37
|
+
'webp_pipe': '.webp',
|
|
38
|
+
'bmp_pipe': '.bmp',
|
|
39
|
+
'tiff_pipe': '.tiff',
|
|
40
|
+
'image2': '.jpg', // Default for generic image format
|
|
41
|
+
};
|
|
42
|
+
// Get the actual image format using ffprobe
|
|
43
|
+
function detectImageFormat(filePath) {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
ffmpeg.ffprobe(filePath, (err, metadata) => {
|
|
46
|
+
if (err) {
|
|
47
|
+
return reject(new Error(`Failed to probe image: ${err.message}`));
|
|
48
|
+
}
|
|
49
|
+
const formatName = metadata.format.format_name || '';
|
|
50
|
+
const extension = FORMAT_TO_EXTENSION[formatName] || '.jpg';
|
|
51
|
+
resolve(extension);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
32
55
|
function getPositionFromAlignment(horizontalAlign, verticalAlign, paddingX, paddingY) {
|
|
33
56
|
let x;
|
|
34
57
|
let y;
|
|
@@ -99,9 +122,20 @@ async function executeAddTextToImage(imagePath, text, options, itemIndex) {
|
|
|
99
122
|
positionX = options.x || '(w-text_w)/2';
|
|
100
123
|
positionY = options.y || '(h-text_h)/2';
|
|
101
124
|
}
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
const
|
|
125
|
+
// Determine output extension - detect actual format if input has .tmp extension
|
|
126
|
+
let outputExt = path.extname(imagePath).toLowerCase();
|
|
127
|
+
const knownImageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.tiff'];
|
|
128
|
+
if (!knownImageExtensions.includes(outputExt)) {
|
|
129
|
+
// Input has unknown extension (e.g., .tmp from URL download), detect actual format
|
|
130
|
+
try {
|
|
131
|
+
outputExt = await detectImageFormat(imagePath);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Fallback to .jpg if detection fails
|
|
135
|
+
outputExt = '.jpg';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const outputPath = (0, utils_1.getTempFile)(outputExt);
|
|
105
139
|
// Escape single quotes in text
|
|
106
140
|
const escapedText = text.replace(/'/g, `''`);
|
|
107
141
|
// Build drawtext filter
|
package/package.json
CHANGED