Ver código fonte

adjust jpg quality in other locations too

Blake Blackshear 4 anos atrás
pai
commit
d3524ee46f
2 arquivos alterados com 2 adições e 2 exclusões
  1. 1 1
      frigate/http.py
  2. 1 1
      frigate/object_processing.py

+ 1 - 1
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)

+ 1 - 1
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: