From 225f3399c804fdb64e911a5b306b91e76158c5a6 Mon Sep 17 00:00:00 2001 From: Michael J Evan Date: Tue, 20 Oct 2026 00:14:28 -0400 Subject: [PATCH] INDI camera: accept fpack-compressed .fits.fz frames INDI drivers with CCD_COMPRESSION on send .fits.fz (an empty primary HDU followed by a tile-compressed image). PHD2 only accepted .fits and stopped capturing with "Unknown image format: .fits.fz". --- src/cam_indi.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cam_indi.cpp b/src/cam_indi.cpp index 2781d6c63..2b606de35 100644 --- a/src/cam_indi.cpp +++ b/src/cam_indi.cpp @@ -846,6 +846,12 @@ bool CameraINDI::ReadFITS(CapturedFrame *frame, usImage& img, bool takeSubframe, return true; } + // A ".fits.fz" frame (INDI drivers with compression enabled) is fpack'ed: an empty primary HDU + // followed by the tile-compressed image, which CFITSIO reads like an ordinary image HDU + bool compressed = strcmp(frame->m_format, ".fits.fz") == 0; + if (compressed) + fits_movabs_hdu(fptr, 2, nullptr, &status); + int hdutype; if (fits_get_hdu_type(fptr, &hdutype, &status) || hdutype != IMAGE_HDU) { @@ -872,7 +878,7 @@ bool CameraINDI::ReadFITS(CapturedFrame *frame, usImage& img, bool takeSubframe, PHD_fits_close_file(fptr); return true; } - if (nhdus != 1 || naxis != 2) + if (nhdus != (compressed ? 2 : 1) || naxis != 2) { pFrame->Alert(_("Unsupported FITS file")); PHD_fits_close_file(fptr); @@ -1119,7 +1125,7 @@ bool CameraINDI::Capture(usImage& img, const CaptureParams& captureParams) first_frame = false; // exposure complete, process the file - if (strcmp(frame->m_format, ".fits") == 0) + if (strcmp(frame->m_format, ".fits") == 0 || strcmp(frame->m_format, ".fits.fz") == 0) { if (INDIConfig::Verbose()) Debug.Write(wxString::Format("INDI Camera Processing fits file\n"));