Camera Tether and Preview

I occasionally take selfies, because it is much easier than to go to a professional photographer. The results are not as good, but at the same time I can learn more about photography myself. The problem with selfies is that one doesn't really see what is going on, unless one takes them with a smartphone. But my arm is too short to give a natural distance between camera and myself. So I take a tripod. But the selfie camera in my phone has a small focal length, so it doesn't really work on longer distances.

Therefore I take my DSLR camera, an ancient Canon EOS 350D. I have an infrared remote for it, but one cannot see the pictures that I have taken. I can go behind the camera, and take a look, but that's not really suitable for adjusting a single light a little bit. Also I have no idea whether my face was within one of the focus points.

Luckily one can attach the camera via USB to the computer. Then one can take a picture and directly download it. For this I use gphoto2 on Linux. With a little Python script (see below), I just periodically take pictures and download them to the laptop.

In order to get a preview without programming a lot, I use Gwenview, an image previewer. It has the feature that when you delete the image which is currently open, it will just go to the next one in the directory. So by adding a new picture and deleting the old one, one can make Gwenview always show the latest image.

In order to get a sensible idea of the focus zones, I took a couple pictures where I put an object right below each focus zone. Then I made this mask using the seven images:

The Python script then uses Image Magick to put that mask on top of the most recent image of the camera and show that with the Gwenview hack:

import pathlib
import shutil
import subprocess
import time

def main():
    while True:
        preview_dir = pathlib.Path("preview")
        picture_dir = pathlib.Path("pictures")
        pictures_before = list(picture_dir.glob("*.JPG"))['gphoto2', '--capture-image-and-download'], check=True, cwd=picture_dir)
        pictures_after = list(picture_dir.glob("*.JPG"))
        new_picture, = set(pictures_after) - set(pictures_before)

        old_previews = list(preview_dir.glob("*.JPG"))
        print(old_previews)['composite', 'mask.png', new_picture, preview_dir /])
        print('copy done')
        for old_preview in old_previews:


if __name__ == "__main__":

All in all this is an interesting setup, and it didn't take any effort or investments. Using the existing hardware I was able to create an automatic photo loop with preview. It works pretty well, one can do small adjustments and see the results a few seconds later on screen.