This page is for people who are new to the Allsky software and describes how Allsky works, what the various pieces are, and how they fit together. Although it is not necessary to know this in order to successfully use Allsky, it can help while troubleshooting and many people will find it interesting. If you haven't already read the Nomenclature page, do so now as many of the terms described there are used on this page.

#### What does Allsky do?

The Allsky software is used to control an allsky camera which takes pictures of "all the sky". Once a picture is taken it is saved to disk and optionally processed and uploaded to an Allsky Website (either on the Pi and/or on a remote server running the Allsky Website software). It can also be uploaded to a remote server not running the Allsky Website software. At the end of the night, a startrails image, LINK, a keogram image, and/or timelapse video can be created and uploaded.

#### How does Allsky work?

Allsky automatically starts whenever your Pi is turned on or rebooted. It can also be started and stopped manually, and is restarted as needed when changing settings in the WebUI. When Allsky starts it checks a few things then executes a program to take the pictures. That program is either `capture_ZWO` or `capture_RPi`, depending on your camera type. The appropriate capture program first looks at many of the settings in the WebUI to determine how to expose pictures, how long to wait between pictures, when to switch between daytime and nighttime, and many other things. It then begins taking pictures. `capture_ZWO` uses a ZWO library to control the camera directly and get feedback from it. `capture_RPi` calls another program called `libcamera-still` to actually take a picture passing it the exposure time and other settings including the name of the file to save the picture to.

After the picture is saved, usually to a file called ~/allsky/tmp/image.jpg, the capture program calls the `saveImage.sh` program to process the image while the capture program checks if a night-to-day transitioned occurred; if so, the capture program calls `endOfNight.sh` to create startrails, keograms, and a timelapse video as specified in the settings. Either way, the capture program then sleeps until it is time to take the next image.

#### Image processing

The `saveImage.sh` program first checks if the image is corrupt and then checks the settings in the WebUI to determine if the image is too dark or too bright. If any of those checks fail the image is deleted and `saveImage.sh` exits. If the image is good, it's optionally resized, cropped, and/or stretched per the settings, and an optional overlay is added. If the image is to be uploaded, `saveImage.sh` checks if it should first be resized, then calls `upload.sh` to upload it. If the image will be part of a mini-timelapse, `saveImage.sh` check if there are enough images to create a mini-timelapse; if so, it is created and optionally resized and uploaded. If not, the image is added to the list of images for the next mini-timelapse.

Finally, if the image is to be saved a copy of it with a name image-YYYYMMDDHHMMSS.jpg is added the the current day's folder in ~/allsk/images.

#### End of night processing

The `endOfNight.sh` program checks the settings to see whether or not a startrails, keogram, and/or timelapse video is to be created; if so they are created. If the items are to be uploaded they are. Either way, `endOfNight.sh` then exits.