For some years now we have wanted to process the .FITS allsky camera original images a little better.
Specifically it would be nice to pull out the CCD Temperature and actually annotate it right on the image.
This would allow us to see in an instant if the peltier cooler was actually running or not, as something the gmouse scripts do not quite get it right and do not turn it in at the start of a run.
The .FITS header is a long, variable length? string of a few thousand characters. We are searching for

Running on our linux box, Fedora 15 with imagemagick.
These lines look inside the .FIT image, pulling out all text between the start of what we want “CCD-TEMP=” and the end of what we want “TEMPERAT” and putting them into a text file.

for i in *.fit
strings $i | sed -n ‘s/.*CCD-TEMP= \(.*\)TEMPERAT.*/\1/ip;T;q’ | cut -c 1-20 > $i.txt

What comes out looks like this:
a temperature of -14.8 Deg C in scientific notation. That is a little too long and most are insignificant digits so it would be nice to convert that to general numbers.

temper2=$(awk ‘{sum += $1} END { printf (“%3d\n”, sum) }’ $i.txt)

This take the value in the .txt file and assigns it to a variable in the format of a general number.

lastly we start the conversion process from .fit to .jpg with text annotations and noise reduction.

convert -interlace NONE -noise 1 1-$i.jpg 2-$i.jpg
# use imagemagick tools to add text annotation
convert -interlace NONE -comment ‘copyright StarlightCascade Observatory SBIG ST237A’ \
-font helvetica -fill white -pointsize 16 \
-draw ‘text 8,20 “Starlight Cascade Observatory 44.22.39N 76.45.47W”‘ \
-draw ‘text 300,50 “N”‘ -draw ‘text 550,220 “W”‘ \
-draw ‘text 360,480 “S”‘ -draw ‘text 120,290 “E” ‘ \
-pointsize 14 -draw ‘text 10,470 ‘$i’.jpg ‘ \
-draw ‘text 550,20 “SBIG ST237A”‘ \
-font helvetica -fill white -pointsize 12 \
-draw ‘text 530,40 “CCD-TEMP=”‘ \
-draw “text 620,40 ‘$temper2’ ” \
2-$i.jpg $i.jpg
rm $i.txt
rm 1-$i.jpg
rm 2-$i.jpg

What comes out in the end? This final image:

The final positioning of the temperature number was a little too close to the CCD-TEMP= but that has been corrected for tonights run.