From aaaebf3302f3d7c7f02719694523b294cc1902db Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 6 Feb 2020 22:02:35 +0100 Subject: [PATCH] wallpaper: lower compression level Otherwise, we use quite a lot of CPU to save the PNG image. --- bin/build-wallpaper | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/build-wallpaper b/bin/build-wallpaper index b862b10..1310cff 100755 --- a/bin/build-wallpaper +++ b/bin/build-wallpaper @@ -24,6 +24,8 @@ parser.add_option("-t", "--target", dest="target", default="background.png", help="write background to FILE", metavar="FILE") parser.add_option("-c", "--crop", dest="crop", action="store_true", help="crop image instead of centering them") +parser.add_option("--compression", default=0, type=int, + help="compression level when saving") options, args = parser.parse_args() assert not args, "No additional arguments are accepted" @@ -117,5 +119,5 @@ assert background, "Don't know the size of the display area" with tempfile.NamedTemporaryFile( delete=False, dir=os.path.dirname(os.path.realpath(options.target))) as tmp: - background.save(tmp, "png") + background.save(tmp, "png", compress_level=options.compression) os.rename(tmp.name, options.target)