wallpaper: favor bigger images

This commit is contained in:
Vincent Bernat 2018-08-01 14:28:44 +02:00
parent 2588551af0
commit 197e5cdb1d

View file

@ -55,8 +55,10 @@ for base, _, files in os.walk(os.path.join(options.directory)):
'.jpeg',
'.png'):
images.append(os.path.join(base, i))
images = random.sample(images, len(screens))
images = random.sample(images, len(screens) + 3)
images = [Image.open(image) for image in images]
images.sort(key=lambda im: -im.size[0]*im.size[1])
images = images[:len(screens)]
# If more than one screen and one image has the right aspect ratio,
# use it.