Merge branch 'master' of git.opaque.tech:denis/huepaper

This commit is contained in:
Denis Lehmann 2021-07-16 02:58:08 +02:00
commit 61c9889ae2
3 changed files with 28 additions and 21 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2020 Denis Lehmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -24,9 +24,15 @@
If you have a recent version of the [[https://nixos.org/][Nix package manager]] installed and flakes are enabled, run huepaper like this:
#+begin_example sh
nix run github:Deleh/huepaper -- --help
nix run github:Deleh/huepaper
#+end_example
Parameters can be passed by appending a double-dash:
#+begin_example sh
nix run github:Deleh/huepaper -- -hue 0.5 --color lightblue
#+end_example
Global installation can be done by including this flake in your flaked NixOS configuration as always :)
*** Legacy
@ -38,7 +44,7 @@
#+begin_example sh
pip install -r requirements.txt
./huepaper.py --help
./huepaper.py
#+end_example
To install it in your Python environment run:
@ -53,8 +59,7 @@
:END:
#+begin_example text
usage: huepaper [-h] [-s SIZE] [-c COLOR] [-p] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-P [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN]
[-smax SMAX] [-lmin LMIN] [-lmax LMAX]
usage: huepaper [-h] [-s SIZE] [-c COLOR] [-np] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-P [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN] [-smax SMAX] [-lmin LMIN] [-lmax LMAX]
Create wallpapers based on color hues.
@ -62,10 +67,10 @@
-h, --help show this help message and exit
-s SIZE, --size SIZE size of huepaper in the form WIDTHxHEIGHT (default: 1920x1080)
-c COLOR, --color COLOR
color, the huepaper is generated from (uses a random color if not given)
-p, --preview preview huepaper
base color from which the huepaper is generated (default: random color)
-np, --no-preview don't preview the huepaper
-o OUTPUT, --output OUTPUT
file where to save the huepaper to (default: None)
filepath where the huepaper will be saved
-l [LINES], --lines [LINES]
include one to three random lines in base color with given opacity in range [0, 1] (default: 0.3)
-lb [LINES_BRIGHT], --lines_bright [LINES_BRIGHT]
@ -109,39 +114,39 @@
#+caption: Huepaper 1
[[./images/huepaper_1.png]]
=huepaper.py -p=
=huepaper=
--------------
#+caption: Huepaper 1
[[./images/huepaper_2.png]]
=huepaper.py -p -c lightgreen=
=huepaper -c lightgreen=
--------------
#+caption: Huepaper 3
[[./images/huepaper_3.png]]
=huepaper.py -p -c "#ff7f50" -lb 0.05=
=huepaper -c "#ff7f50" -lb 0.05=
--------------
#+caption: Huepaper 4
[[./images/huepaper_4.png]]
=huepaper.py -p -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0=
=huepaper -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0=
--------------
#+caption: Huepaper 5
[[./images/huepaper_5.png]]
=huepaper.py -p -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36=
=huepaper -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36=
--------------
#+caption: Huepaper 6
[[./images/huepaper_6.png]]
=huepaper.py -p -l -lb -ld -e nixos.png=
=huepaper -l -lb -ld -e nixos.png=

View File

@ -42,11 +42,13 @@ if __name__ == "__main__":
parser.add_argument(
"-c",
"--color",
help="color, the huepaper is generated from (uses a random color if not given)",
help="base color from which the huepaper is generated (default: random color)",
)
parser.add_argument("-p", "--preview", action="store_true", help="preview huepaper")
parser.add_argument(
"-o", "--output", help="file where to save the huepaper to (default: None)"
"-np", "--no-preview", action="store_true", help="don't preview the huepaper"
)
parser.add_argument(
"-o", "--output", help="filepath where the huepaper will be saved"
)
parser.add_argument(
"-l",
@ -117,7 +119,7 @@ if __name__ == "__main__":
args = parser.parse_args()
size = args.size
color = args.color
preview = args.preview
no_preview = args.no_preview
output = args.output
lines = args.lines
lines_bright = args.lines_bright
@ -139,8 +141,8 @@ if __name__ == "__main__":
parser.error("The size must be given in form: 1920x1080")
# Check preconditions
if not preview and not output:
parser.error("You must either set -p (--preview) or -o (--output)")
if no_preview and not output:
parser.error("You must either omit -np (--no-preview) or set -o (--output)")
if pixelate:
try:
values = pixelate.split("x")
@ -171,7 +173,7 @@ if __name__ == "__main__":
image.mode = "RGB"
if preview:
if not no_preview:
image.show()
if not output:
save = input("Do you want to save the image? [y/N] ")