Close camera preview after taking a picture or a sequence

This commit is contained in:
Fabio Manganiello 2019-08-16 18:30:49 +02:00
parent 284ec129d9
commit c93af07333
1 changed files with 10 additions and 0 deletions

View File

@ -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