From c8c0017eaca1bdfbd1b50056e82a18aa5a51b20f Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 4 Aug 2021 03:38:36 +0200 Subject: [PATCH] Limit to full size image. --- controlpi_plugins/camera.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/controlpi_plugins/camera.py b/controlpi_plugins/camera.py index 5459418..065f6f1 100644 --- a/controlpi_plugins/camera.py +++ b/controlpi_plugins/camera.py @@ -73,9 +73,8 @@ class Camera(BasePlugin): loop = asyncio.get_running_loop() executor = concurrent.futures.ThreadPoolExecutor() camera = picamera.PiCamera() - camera.resolution = (2592, 1944) # Maximal resolution of PiCamera - camera.framerate = 15 # Maximal framerate at maximal resolution camera.iso = self._iso + camera.resolution = self._full web_path = os.path.join(self.conf['path'], 'web.jpg') thumb_path = os.path.join(self.conf['path'], 'thumb.jpg') try: @@ -107,15 +106,9 @@ class Camera(BasePlugin): functools.partial( camera.capture, stream, 'jpeg')) stream.seek(0) - raw_image = await loop.run_in_executor( - executor, - functools.partial(PIL.Image.open, stream)) full_image = await loop.run_in_executor( executor, - functools.partial( - raw_image.resize, - self._full, - PIL.Image.ANTIALIAS)) + functools.partial(PIL.Image.open, stream)) await loop.run_in_executor( executor, functools.partial( @@ -123,7 +116,7 @@ class Camera(BasePlugin): web_image = await loop.run_in_executor( executor, functools.partial( - raw_image.resize, + full_image.resize, self._web, PIL.Image.ANTIALIAS)) await loop.run_in_executor( @@ -133,7 +126,7 @@ class Camera(BasePlugin): thumb_image = await loop.run_in_executor( executor, functools.partial( - raw_image.resize, + full_image.resize, self._thumb, PIL.Image.ANTIALIAS)) await loop.run_in_executor( -- 2.34.1