From 9466df90e089bb0248b92d4b0319d9ef48b9664f Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Mon, 11 May 2026 18:13:29 +0800 Subject: [PATCH] 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. --- apps/api/src/lib/format-decoders.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/api/src/lib/format-decoders.ts b/apps/api/src/lib/format-decoders.ts index c5031d58..dd2ea6f5 100644 --- a/apps/api/src/lib/format-decoders.ts +++ b/apps/api/src/lib/format-decoders.ts @@ -438,7 +438,13 @@ async function decodeFits(buffer: Buffer): Promise { 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);