From 3cf5a587ced6dc930d7f8db79bcc42e68b8aa1aa Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Fri, 30 Jun 2023 15:11:46 +0000 Subject: [PATCH] plug-ins: Match RGB FITS orientation to SiriL Switching to the cfitsio library's fits_read_img () function in 03ea666f caused RGB FITS images to be read in upside down per SiriL developers and NASA standards (odd, since cfitsio is maintained by NASA). This flips them back. --- plug-ins/file-fits/fits.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plug-ins/file-fits/fits.c b/plug-ins/file-fits/fits.c index a6f941cc6d..e7d891ed2b 100644 --- a/plug-ins/file-fits/fits.c +++ b/plug-ins/file-fits/fits.c @@ -605,6 +605,17 @@ load_image (GFile *file, show_fits_errors (status); g_object_unref (buffer); + + if (hdu.naxisn[2] && hdu.naxisn[2] == 3) + { + /* Per SiriL developers, FITS images should be loaded from the + * bottom up. fits_read_img () loads them from top down, so we + * should flip the layer. */ + gimp_item_transform_flip_simple (GIMP_ITEM (layer), + GIMP_ORIENTATION_VERTICAL, + TRUE, -1.0); + } + if (pixels) g_free (pixels);