> For the complete documentation index, see [llms.txt](https://docs.tjuav.org/tjuav/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tjuav.org/tjuav/hardware-1/cameras/gphoto2.md).

# Gphoto2

### Gphoto Usage

Gphoto2 has several options for capturing and downloading images from these cameras. There is a command line interface, and a python library as a wrapper.

From the [command line interface](https://github.com/gphoto/gphoto2), the user can call --capture-image to trigger an image capture not not download it, and --capture-image-and-download to capture an image and download it from the camera onto the computer, however the download process takes around two seconds before the next image can be taken, as the camera stores the image on the SD card first. The a5100 has the option of liveview image download through --capture-preview, which instantly captures and downloads a 720p image.&#x20;

The python library, called [python-gphoto2](https://github.com/jim-easterbrook/python-gphoto2), wraps most of the functions of the command line interface and allows better control of the camera in code. The best way to capture images using the python wrapper is to trigger capture using `trigger_capture`, and download it directly from the camera, bypassing the SD card, using the `wait_for_event` function, which waits for an event (such as a new image file appearing in the camera). See [this](https://github.com/jim-easterbrook/python-gphoto2/blob/main/examples/wait-for-event.py) example, and add a `trigger_capture` call before the `wait_for_event` call. A more refined version is implemented in flightsoftware, which waits until 0.5 seconds after the previous image capture to trigger the next capture, to keep the image capture interval more consistent.
