Limit to full size image.
authorBenjamin Braatz <bb@bbraatz.eu>
Wed, 4 Aug 2021 01:38:36 +0000 (03:38 +0200)
committerBenjamin Braatz <bb@bbraatz.eu>
Wed, 4 Aug 2021 01:38:36 +0000 (03:38 +0200)
controlpi_plugins/camera.py

index 5459418149bf87a9d045cb083aea61cd374f03ba..065f6f1643f5ecee278cdbe21bf2283a62892ff8 100644 (file)
@@ -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(