plug-ins: Fix bug with RGB FITS export

Resolves #13842
fits_write_img () was incorrectly used, since we
were writing one channel of RRR...GGG...BBB... data
at a time. This patch switches to fits_write_pix (), and
increments the first pixel's 3rd index after writing
each channel so that the next channel is written from
the correct starting point.

(cherry picked from commit 1376d25453)
This commit is contained in:
Alx Sa 2025-07-19 23:36:20 +00:00 committed by Jehan
parent 0ad20e9978
commit 7f25157cbd

View file

@ -889,12 +889,14 @@ export_fits (GFile *file,
}
else
{
glong fpixel[3] = {1, 1, 1};
gdouble *rgb_data;
gdouble *rgb_output;
const Babl *rgb_format;
const Babl *output_format = babl_format ("Y' double");
const Babl *converted_format;
rgb_format = (channelnum == 3) ? babl_format ("R'G'B' double") :
babl_format ("R'G'B'A double");
@ -943,12 +945,13 @@ export_fits (GFile *file,
babl_process (babl_fish (output_format, converted_format),
rgb_output, converted_output, nelements);
if (fits_write_img (fptr, export_type, 1, nelements,
if (fits_write_pix (fptr, export_type, fpixel, nelements,
converted_output, &status))
{
show_fits_errors (status);
return FALSE;
}
fpixel[2]++;
g_free (converted_output);
}