From 570a1a41442b2fdcbde7faa09eb62382b0abcb50 Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Fri, 29 Mar 2024 21:16:00 -0700 Subject: [PATCH] Decrease resource usage --- inkybot.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/inkybot.py b/inkybot.py index c0f7df8..7e6c884 100755 --- a/inkybot.py +++ b/inkybot.py @@ -262,14 +262,11 @@ class PictureMode(inkybot.StateClass): image = Image.open(f"{self.picpath}/{fn}") # XXX FIXME: os join function instead - enhancer = ImageEnhance.Color(image) - adjustedimage = enhancer.enhance(1.5) - resizedimage = self.parent.resize_with_letterbox( - adjustedimage, + image, self.parent.inky.resolution, self.parent.average_outer_perimeter_color(image) - ) + ) self.set_image(resizedimage) @@ -320,6 +317,11 @@ class HassMode(inkybot.StateClass): service = Service(self.driver_path) options = webdriver.ChromeOptions() options.add_argument('--headless') + options.add_argument('--disable-gpu') # GPU hardware acceleration isn't needed for headless + options.add_argument('--no-sandbox') # Disable the sandbox for all software features + options.add_argument('--disable-dev-shm-usage') # Overcome limited resource problems + options.add_argument('--disable-extensions') # Disabling extensions can save resources + options.add_argument('--disable-plugins') # Disable plugins self.driver = webdriver.Chrome(service=service, options=options) width,height = [self.screen_scale * x for x in self.parent.inky.resolution] @@ -385,7 +387,7 @@ class HassMode(inkybot.StateClass): if __name__ == "__main__": - #inkybot.start('picture') - inkybot.start('hass') + inkybot.start('picture') + #inkybot.start('hass')