mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-26 19:58:35 +02:00
wallpaper: lower compression level
Otherwise, we use quite a lot of CPU to save the PNG image.
This commit is contained in:
parent
ffeef58722
commit
aaaebf3302
1 changed files with 3 additions and 1 deletions
|
@ -24,6 +24,8 @@ parser.add_option("-t", "--target", dest="target", default="background.png",
|
||||||
help="write background to FILE", metavar="FILE")
|
help="write background to FILE", metavar="FILE")
|
||||||
parser.add_option("-c", "--crop", dest="crop", action="store_true",
|
parser.add_option("-c", "--crop", dest="crop", action="store_true",
|
||||||
help="crop image instead of centering them")
|
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()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
assert not args, "No additional arguments are accepted"
|
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(
|
with tempfile.NamedTemporaryFile(
|
||||||
delete=False,
|
delete=False,
|
||||||
dir=os.path.dirname(os.path.realpath(options.target))) as tmp:
|
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)
|
os.rename(tmp.name, options.target)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue