Skip to content

Fix #1261

Adrian Knagg-Baugh requested to merge ser-flips into master

Fix .SER orientation by consistently transforming to BOTTOM-UP row order on load (accounting for the Bayer pattern flip) and transforming to TOP-DOWN on save (if needed; FITS that are already TOP-DOWN are left alone).

Sidestep the problem of TOP-DOWN FITS by simply getting rid of them on sight. Any TOP-DOWN FITS Siril encounters is immediately converted to a BOTTOM-UP FITS: the pixel array is flipped, the row_order string is flipped, the WCS is flipped and if necessary the Bayer pattern identifier is flipped.

After this the FITS behaves exactly as any other BOTTOM-UP FITS would: it displays correctly in the correct orientation, and becomes fully compliant with the original NASA FITS specification. There is no further change required to any other part of Siril because the image is just like any other BOTTOM-UP FITS from this point on. When the file is saved it remains BOTTOM-UP, so there is only the (very minor) flip overhead the first time a TOP-DOWN file is encountered.

Note that this relies on the FITS header already having been read in order to know the FITS orientation. The header data as viewed using the Tools -> FITS HEADER menuentry will be out of date until the next time the image is saved (however this is consistent with other aspects of Siril that don't update that data except for when the file is saved).

Edited by Adrian Knagg-Baugh

Merge request reports