diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-30 22:44:37 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-30 22:44:37 +1100 |
| commit | 55da502880549d9fd7f4bc01da58dcbccc55eb9a (patch) | |
| tree | ba9a662044824a50cf2d76122f0be782ee5f4b70 /scheme/resizeimg.py | |
| parent | install: hypr optional trash-cli (diff) | |
| download | caelestia-cli-55da502880549d9fd7f4bc01da58dcbccc55eb9a.tar.gz caelestia-cli-55da502880549d9fd7f4bc01da58dcbccc55eb9a.tar.bz2 caelestia-cli-55da502880549d9fd7f4bc01da58dcbccc55eb9a.zip | |
scheme: better light/dark theme detection
Diffstat (limited to 'scheme/resizeimg.py')
| -rwxr-xr-x | scheme/resizeimg.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/scheme/resizeimg.py b/scheme/resizeimg.py deleted file mode 100755 index e18ffb8..0000000 --- a/scheme/resizeimg.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python - -import sys -import math -from PIL import Image - - -def calc_size(w, h, b = 128): - ia = w * h - ba = b * b - s = math.sqrt(ba / ia) if ia > ba else 1 - return max(1, round(w * s)), max(1, round(h * s)) - - -def resize(img): - w, h = calc_size(img.width, img.height) - if w < img.width or h < img.height: - return img.resize((w, h), Image.Resampling.BICUBIC), True - return img, False - - -if __name__ == "__main__": - with Image.open(sys.argv[1]) as img: - img, resized = resize(img) - if resized: - img.save("/tmp/caelestia-resize.png") - print("/tmp/caelestia-resize.png") - else: - print(sys.argv[1]) |