Option to not scale DSLR FITS files

At the moment when saving DSLR files as FITS they are scaled from 14 bit to 16 bit (at least for the Canon 60D which is a 14 bit camera). Would it be possible to have an option to save the FITS data as unscaled?
At the moment SGPro is not the most efficient way to generate calibration frames [1], nor is it necessarily the only capture tool that has been used on a particular target. I have historical data from other capture tools that has not been rescaled, and I can not integrate the two together.

I understand that it would not be possible to just change the behaviour as that would impact users who have set up their calibration frames / existing light frames with SGPro, but could we please have a check box in the camera configuration dialogs to write the data out to the FITS file unscaled.

[1] For darks it is easier to use an intervalometer and just leave the camera out without needing to setup a PC, for Bias frames I can just put the camera into high speed shutter and hold the shutter button down and for flats it is far easier to use AV mode and let the camera sort out the exposure time than it is to use the Flats Wizard

Even with no scaling you likely won’t be able to use them together. There is no real standard for storing fits data so we may store it one way and another application may do something different. These differences can include ocerscan handling, scaling, data orientation, just to name a few.

If you need something that is transportable across multiple applications then you should use CR2.


Ok, thanks. It is a real shame as the capture information in the FITS header is very useful. I currently have a Python script that inserts the guiding information from the PHD2 log file into the FITS Header that I would really like to keep (I use the RMS Guide Error and peak errors as extra metrics in the PixInsight Subframe Selector).

Because both you and PixInsight use DCRaw. The files are at least compatable (with regards to overscan and orientation). If I use a python script to divide the FITS file by 4 and then use PixelMath to compare the FITS with the CR2 they are identical.

I will extend my Python script to rescale the FITS file as well as insert extra headers for the time being, until I can sell enough organs to afford a CCD.


I took a closer look at SGP’s FITS files from my Canon EOS 600D (14-bit) and found that SGP scales the original values in the following manner:

I = I0 * 4 - 1
(The subtraction will not be executed if I0 is zero.)

This means that the scaling does not destroy any data, and we can withdraw the scaling in PixInsight by the following PixelMath calculation:

($T*2^16 + 1)/2^18
(‘Rescale result’ must be unchecked.)

I did the PixelMath on one of SGP’s FITS files (that was saved as CR2 file as well) and compared the result with the corresponding CR2 file that was raw developed with dcraw v9.27, parameters: -4 -o 0 -r 1 1 1 1 -D -t 0 -k 0 -H 1 -T
The results are identical. In this way you can convert light frames from a camera with 14-bit ADC that are saved as FITS files by SGP so that they are compatible with calibration frames that are saved as CR2 files. Up to now I saved FITS and CR2 files. In future I will save my light frames from SGP as FITS files only.

I guess that files from a camera with 12-bit ADC can be converted analogously.


Wonder why the -1, it seems to mean that camera values of 0, 1, 2 … 16383 will become 0, 3, 7 … 65531.
The only reason I can think of is that the camera actually has a maximum value of 16384 which is outside the 14 bit numeric range and this forces it to 65535 instead of 65536 thus keeping it in the 16bit range of the FITS data.

Hi Chris,

I don’t know why, it’s just what I found out. My Canon EOS 600D has maximum values of about 15310 - end of the rope. However, I guess this is adjusted in the camera and will be different with different exemplars.