A Python package to convert camera raw images to astronomical fits files.
pip install raw2fitsfrom raw2fits.image import Image
img = Image(path='path/to/raw/image', debayer_method="VNG")
img.save_fits(image_type="LIGHT", path='path/to/save/fits/image')where debayer_method can be one of the following: "VNG", "Bilinear". We recommend using "VNG" for better results, this is also the default method used by PixInsight and this package. raw2fits supports 16-bit VNG debayer method, which is not supported by OpenCV yet.
The following images are the result of converting a raw image to a fits file using different debayer methods.
| Debayer Method | Image |
|---|---|
| Bilinear | ![]() |
| VNG | ![]() |
| VNG (by Pixinsight) | ![]() |
| Debayer Method | Image |
|---|---|
| Bilinear | ![]() |
| VNG | ![]() |
| VNG (by Pixinsight) | ![]() |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This extraction of the bayer image is based on the rawpy.





