aboutsummaryrefslogtreecommitdiffstats
path: root/identicon/gen_blockie.py
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-05-07 07:26:01 +0000
committerterminaldweller <devi@terminaldweller.com>2023-05-07 07:26:01 +0000
commit3315acb9ca79b2f6bbd68ec99c4506fc3ae7ca92 (patch)
tree4f0c5e66c2a824a2420ec211ee0585bece03fda8 /identicon/gen_blockie.py
parentupdate (diff)
downloadscripts-3315acb9ca79b2f6bbd68ec99c4506fc3ae7ca92.tar.gz
scripts-3315acb9ca79b2f6bbd68ec99c4506fc3ae7ca92.zip
update
Diffstat (limited to 'identicon/gen_blockie.py')
-rwxr-xr-xidenticon/gen_blockie.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/identicon/gen_blockie.py b/identicon/gen_blockie.py
index 60d56e0..f8f3d56 100755
--- a/identicon/gen_blockie.py
+++ b/identicon/gen_blockie.py
@@ -17,6 +17,13 @@ class Argparser: # pylint: disable=too-few-public-methods
default="",
)
self.parser.add_argument(
+ "--input",
+ "-i",
+ type=str,
+ help="path to the input file",
+ default="./identicon.png",
+ )
+ self.parser.add_argument(
"--out",
"-o",
type=str,
@@ -63,27 +70,27 @@ class Argparser: # pylint: disable=too-few-public-methods
def main() -> None:
argparser = Argparser()
- if argparser.args.seed == "":
+ seed = str()
+ if argparser.args.input != "":
with open(
- "../terminaldweller.com/main/srv/.well-known/openpgpkey/hu/gpg_pubkey.asc",
+ argparser.args.input,
mode="rb",
) as gpg_pubkey:
key_content = gpg_pubkey.read()
+ seed = str(key_content)
- data = blockies.create(str(key_content), size=10, scale=100)
- with open("identicon.png", "wb") as png:
- png.write(data)
else:
- data = blockies.create(
- argparser.args.seed,
- size=argparser.args.size,
- scale=argparser.args.scale,
- color=argparser.args.fgcolor,
- bgcolor=argparser.args.bgcolor,
- spotcolor=argparser.args.spotcolor,
- )
- with open(argparser.args.out, "wb") as png:
- png.write(data)
+ seed = argparser.args.seed
+ data = blockies.create(
+ argparser.args.seed,
+ size=argparser.args.size,
+ scale=argparser.args.scale,
+ color=argparser.args.fgcolor,
+ bgcolor=argparser.args.bgcolor,
+ spotcolor=argparser.args.spotcolor,
+ )
+ with open(argparser.args.out, "wb") as png:
+ png.write(data)
if __name__ == "__main__":