fix: extract first frame from multi-image FITS files

ImageMagick outputs numbered files (fits-out-0.png, fits-out-1.png)
for multi-image FITS, but decodeFits expected a single output file.
Added [0] selector to extract only the first frame, matching the
pattern used by DDS and PSD decoders.
This commit is contained in:
SnapOtter
2026-05-11 18:13:29 +08:00
parent 2acf0ea48a
commit 9466df90e0
+7 -1
View File
@@ -438,7 +438,13 @@ async function decodeFits(buffer: Buffer): Promise<Buffer> {
await writeFile(inputPath, buffer);
await execFileAsync(
cmd,
magickArgs(cmd, [inputPath, "-normalize", "-colorspace", "sRGB", `png:${outputPath}`]),
magickArgs(cmd, [
`${inputPath}[0]`,
"-normalize",
"-colorspace",
"sRGB",
`png:${outputPath}`,
]),
{ timeout: 120_000 },
);
return await readFile(outputPath);