Skip to content

feat(fits): add FITS image support#436

Open
cek wants to merge 1 commit intoTom94:masterfrom
cek:fits-support
Open

feat(fits): add FITS image support#436
cek wants to merge 1 commit intoTom94:masterfrom
cek:fits-support

Conversation

@cek
Copy link
Copy Markdown

@cek cek commented Apr 3, 2026

No description provided.

@Tom94
Copy link
Copy Markdown
Owner

Tom94 commented Apr 3, 2026

Heya, thanks a lot for the PR. Currently don't have all that much bandwidth, so might be a little bit until I get to review & merge.

@cek
Copy link
Copy Markdown
Author

cek commented Apr 3, 2026

No worries at all -- no rush, and thanks! I'm just happy to be able to examine astrophoto images in my favorite viewer, rather than having to use one of the terrible alternatives. ;)

To be a more full-featured replacement for said alternatives, tev would also need a astrophoto-centric tone mapping operator and associated controls. However, such a specific/extreme tone mapper probably won't be of interest to most tev users, and thus would be a waste of UI space to render it all of the time. Once I have something working, I'm likely to have questions about how to integrate it such that it doesn't clutter the UI when not needed (e.g., a visibility toggle, defaulting to rendering it if a FITS image is loaded, for example...?) Or it may prove to be too specialized to add to tev proper. In any case, more to come.

@Tom94
Copy link
Copy Markdown
Owner

Tom94 commented Apr 3, 2026

I was planning to add soft clipping (log-space sigmoid with configurable min/max brightness) to the HDR popup menu. Probably not the kind of tone mapping you are looking for 😅, but mentioning it just in case.

I think other specialized tone maps would also fit into the HDR popup for now… to be consolidated in an actual tone map selector when/if tev gets support for a bunch of other standard graphics ones (that’d share aforementioned min/max brightness controls and also consume image metadata like max FALL etc.)

@cek cek marked this pull request as draft April 5, 2026 17:07
Copy link
Copy Markdown
Owner

@Tom94 Tom94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR! Looks mostly good to me -- just requesting a few minor changes.

EDIT: oh, and I almost forgot: could you add a fits entry to void ImageViewer::openImageDialog() as well?

Comment thread src/imageio/FitsImageLoader.cpp Outdated
Comment thread src/imageio/FitsImageLoader.cpp Outdated
Comment thread src/imageio/FitsImageLoader.cpp Outdated
Comment thread src/imageio/FitsImageLoader.cpp Outdated
Comment thread src/imageio/FitsImageLoader.cpp Outdated
@cek cek marked this pull request as ready for review April 10, 2026 06:06
@cek
Copy link
Copy Markdown
Author

cek commented Apr 10, 2026

Thanks and sorry about that -- a little too quick on the PR trigger...

@Tom94
Copy link
Copy Markdown
Owner

Tom94 commented Apr 10, 2026

Thanks a lot! I think I can take it from here. Just one more question to make sure: are uint8 fits images really linearly encoded?

If they were sRGB-encoded you could use toFloat32<true>(...) to do the decoding, but generic transfers like gamma curves require a bit of extra code.

And: is there no signed int8 format?

@cek
Copy link
Copy Markdown
Author

cek commented Apr 10, 2026

The vast majority of FITS files hold either linear 12-to-16-bit raw sensor data as uint16, or linear processed (and possibly negative) data as fp32.

They can also hold processed data that is wildly nonlinear -- extreme "stretching" of shadow/lower-order bits where the interesting astro signals live. But FITS data is essentially never sRGB-encoded.

FITS has no real support for signed 8-bit data. I don't think I've ever seen an 8-bit FITS file in the wild, to be honest.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants