strix

A simple web UI for motion
git clone https://www.brianlane.com/git/strix
Log | Files | Refs | LICENSE

commit 6f41453328ee6f1cc045f654bf7370cc5b698094
parent 1eec5721d3524db4c9453dfa32a20a49e54c7a9d
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sun, 14 Apr 2019 17:12:17 -0700

Use 25% point for thumbnail instead of 50%

Diffstat:
Msrc/strix/events.py | 2+-
Msrc/strix/queue.py | 8++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/strix/events.py b/src/strix/events.py @@ -57,7 +57,7 @@ def event_details(log: structlog.BoundLogger, event_path: str) -> Dict: if os.path.exists(event_path+"/thumbnail.jpg"): thumbnail = url+"/thumbnail.jpg" elif images: - thumbnail = images[len(images)//2] + thumbnail = images[len(images)//4] else: thumbnail = "images/missing.jpg" diff --git a/src/strix/queue.py b/src/strix/queue.py @@ -70,12 +70,12 @@ def process_event(log: structlog.BoundLogger, base_dir: str, event: str) -> None except Exception as e: log.error("Failed to create debug video", exception=str(e)) - # Create a thumbnail of the middle image of the capture, on the theory that it - # has the best chance of being 'interesting'. + # Create a thumbnail of the 25% image of the capture, on the theory that it + # has the best chance of being 'interesting' since it is near the trigger point try: images = sorted(list(glob(os.path.join(event_path, "*.jpg")))) - middle = images[int(len(images)/2)] - im = Image.open(middle) + idx = images[int(len(images)//4)] + im = Image.open(idx) # im.size will get the actual size of the image im.thumbnail(THUMBNAIL_SIZE) im.save(os.path.join(event_path, "thumbnail.jpg"), "JPEG")