From d3524ee46fafad2cc98a8f5f65bd6ab81c2fe160 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 5 Feb 2021 07:09:41 -0600 Subject: [PATCH] adjust jpg quality in other locations too --- frigate/http.py | 2 +- frigate/object_processing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index 998d42bc1..e6a87ecc5 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -115,7 +115,7 @@ def event_thumbnail(id): jpg_as_np = np.frombuffer(thumbnail_bytes, dtype=np.uint8) img = cv2.imdecode(jpg_as_np, flags=1) thumbnail = cv2.copyMakeBorder(img, 0, 0, int(img.shape[1]*0.5), int(img.shape[1]*0.5), cv2.BORDER_CONSTANT, (0,0,0)) - ret, jpg = cv2.imencode('.jpg', thumbnail) + ret, jpg = cv2.imencode('.jpg', thumbnail, [int(cv2.IMWRITE_JPEG_QUALITY), 70]) thumbnail_bytes = jpg.tobytes() response = make_response(thumbnail_bytes) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index af36665c7..4aee0f5d2 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -217,7 +217,7 @@ class TrackedObject(): cv2.putText(best_frame, time_to_show, (5, best_frame.shape[0]-7), cv2.FONT_HERSHEY_SIMPLEX, fontScale=font_scale, color=(255, 255, 255), thickness=2) - ret, jpg = cv2.imencode('.jpg', best_frame) + ret, jpg = cv2.imencode('.jpg', best_frame, [int(cv2.IMWRITE_JPEG_QUALITY), 70]) if ret: return jpg.tobytes() else: