Hi,

maybe a few how this fantastic project from Thomas about his allsky cam.

github.com/thomasjacquin/allsky

Sadly it linked to Zwo cams only, so I'm thinking about replacing his capture.cpp file with some python script that does same but using indilib.

As most of the other - not hardware related scripts - use png or jpg files, I'm wondering how to convert fits into jpg or png files.

I tried something like that, using a color cam from QHY, so there is only one HDU object in.

##########################

#!/usr/bin/python3

import sys
import getopt
import PyIndi
import time
import sys
import threading
import io
import numpy as np
from PIL import Image
from astropy.io import fits


def main(argv):
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:")
except getopt.GetoptError:
print ('fitsTojpg.py -i <inputfile> -o <outputfile>')
sys.exit(2)

for opt, arg in opts:
if opt == '-h':
print ('fitsTojpg.py -i <inputfile> -o <outputfile>')
sys.exit()
elif opt in ("-i"):
inputfile = arg
elif opt in ("-o"):
outputfile = arg

print ('Input file is "', inputfile)
print ('Output file is "', outputfile)

image_data = fits.open(inputfile)
print (image_data.info())
dataImage = image_data[0].data
im = Image.fromarray(dataImage)
if im.mode != 'RGB':
im = im.convert('RGB')
im.save(outputfile)
im.close()


if __name__ == "__main__":
main(sys.argv[1:])

##########################

But the quality is not good:

pic1.fits (within pic1.zip): original

File Attachment:

File Name: pic1.zip
File Size: 8,224 KB
one, got by another python script via BLOB.
pic1_astconvertt.jpg: better but still no color (done by astconvertt, part of GNU Astronomy Utilities)
pic1_myscript.jpg: done by the script above

Read More...