From c239721021ae28d8bb5f688c2cb1132d9aeaa62b Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 24 Mar 2025 08:39:51 -0600 Subject: [PATCH] Ensure thumb camera directory exists before saving (#17339) --- frigate/camera/state.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frigate/camera/state.py b/frigate/camera/state.py index 0495be1fc..98f808bf6 100644 --- a/frigate/camera/state.py +++ b/frigate/camera/state.py @@ -461,9 +461,9 @@ class CameraState: # create thumbnail with max height of 175 and save width = int(175 * img_frame.shape[1] / img_frame.shape[0]) thumb = cv2.resize(img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA) - cv2.imwrite( - os.path.join(THUMB_DIR, self.camera_config.name, f"{event_id}.webp"), thumb - ) + thumb_path = os.path.join(THUMB_DIR, self.camera_config.name) + os.makedirs(thumb_path, exist_ok=True) + cv2.imwrite(os.path.join(thumb_path, f"{event_id}.webp"), thumb) def shutdown(self) -> None: for obj in self.tracked_objects.values():