From c93af07333fe91671380ec2b511147f2ad807e2b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 16 Aug 2019 18:30:49 +0200 Subject: [PATCH] Close camera preview after taking a picture or a sequence --- platypush/plugins/camera/pi.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platypush/plugins/camera/pi.py b/platypush/plugins/camera/pi.py index 0a1b2ec34..5e39ff983 100644 --- a/platypush/plugins/camera/pi.py +++ b/platypush/plugins/camera/pi.py @@ -116,6 +116,11 @@ class CameraPiPlugin(CameraPlugin): capture_opts['resize'] = tuple(resize) camera.capture(image_file, **capture_opts) + + if preview: + camera.stop_preview() + + camera.close() return {'image_file': image_file} @action @@ -173,6 +178,11 @@ class CameraPiPlugin(CameraPlugin): images = [os.path.join(directory, name_format % (i+1)) for i in range(0, n_images)] camera.capture_sequence(images, **capture_opts) + + if preview: + camera.stop_preview() + + camera.close() return {'image_files': images} @action