Change clean snapshots from png to webp format (#20484)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions

* save clean webp instead of png

* send clean webp to plus with fallback for old events

* manual event webp

* event cleanup

* api def

* convert png to webp if exists

* update reference config

* change quality
This commit is contained in:
Josh Hawkins
2025-10-14 07:08:41 -06:00
committed by GitHub
parent c091b10df9
commit b05ac7430a
8 changed files with 111 additions and 38 deletions
+5 -3
View File
@@ -530,17 +530,19 @@ class CameraState:
# write clean snapshot if enabled
if self.camera_config.snapshots.clean_copy:
ret, png = cv2.imencode(".png", img_frame)
ret, webp = cv2.imencode(
".webp", img_frame, [int(cv2.IMWRITE_WEBP_QUALITY), 80]
)
if ret:
with open(
os.path.join(
CLIPS_DIR,
f"{self.camera_config.name}-{event_id}-clean.png",
f"{self.camera_config.name}-{event_id}-clean.webp",
),
"wb",
) as p:
p.write(png.tobytes())
p.write(webp.tobytes())
# write jpg snapshot with optional annotations
if draw.get("boxes") and isinstance(draw.get("boxes"), list):