fix: get gif size properly

This commit is contained in:
vaguesyntax
2025-11-29 02:40:28 +03:00
parent 0f11296ee1
commit 3cf14671ad
@@ -18,14 +18,19 @@ Process {
running: true running: true
command: ["bash", "-c", command: ["bash", "-c",
`mkdir -p $(dirname '${processFilePath(filePath)}'); [ -f '${processFilePath(filePath)}' ] || curl -sSL '${sourceUrl}' -o '${processFilePath(filePath)}' && magick identify -format '%w %h' '${processFilePath(filePath)}'[0]` `mkdir -p $(dirname '${processFilePath()}'); [ -f '${processFilePath()}' ] || curl -sSL '${sourceUrl}' -o '${processFilePath()}' && file '${processFilePath()}'`
] ]
stdout: StdioCollector { stdout: StdioCollector {
id: imageSizeOutputCollector id: imageSizeOutputCollector
onStreamFinished: { onStreamFinished: {
const output = imageSizeOutputCollector.text.trim(); const output = imageSizeOutputCollector.text.trim();
const [width, height] = output.split(" ").map(Number); const match = output.match(/(\d+)\s*x\s*(\d+)/);
root.done(root.filePath, width, height);
if (match) {
const width = Number(match[1]);
const height = Number(match[2]);
root.done(root.filePath, width, height);
}
} }
} }
} }