diff options
Diffstat (limited to 'identicon')
-rwxr-xr-x | identicon/gen_blockie.py | 90 | ||||
-rw-r--r-- | identicon/identicon.png | bin | 0 -> 4634 bytes | |||
-rw-r--r-- | identicon/poetry.lock | 53 | ||||
-rw-r--r-- | identicon/pyproject.toml | 16 |
4 files changed, 159 insertions, 0 deletions
diff --git a/identicon/gen_blockie.py b/identicon/gen_blockie.py new file mode 100755 index 0000000..60d56e0 --- /dev/null +++ b/identicon/gen_blockie.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +import argparse +import blockies + + +class Argparser: # pylint: disable=too-few-public-methods + """Argparser class.""" + + def __init__(self): + self.parser = argparse.ArgumentParser() + self.parser.add_argument( + "--seed", + "-s", + type=str, + help="seed phrase", + default="", + ) + self.parser.add_argument( + "--out", + "-o", + type=str, + help="output path", + default="./identicon.png", + ) + self.parser.add_argument( + "--fgcolor", + "-f", + type=str, + help="foreground color", + default=None, + ) + self.parser.add_argument( + "--bgcolor", + "-b", + type=str, + help="background color", + default=None, + ) + self.parser.add_argument( + "--spotcolor", + "-p", + type=str, + help="spot color", + default=None, + ) + self.parser.add_argument( + "--size", + "-z", + type=int, + help="size of image, in blocks", + default=10, + ) + self.parser.add_argument( + "--scale", + "-c", + type=int, + help='size of individual "pixels"', + default=100, + ) + self.args = self.parser.parse_args() + + +def main() -> None: + argparser = Argparser() + if argparser.args.seed == "": + with open( + "../terminaldweller.com/main/srv/.well-known/openpgpkey/hu/gpg_pubkey.asc", + mode="rb", + ) as gpg_pubkey: + key_content = gpg_pubkey.read() + + 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) + + +if __name__ == "__main__": + main() diff --git a/identicon/identicon.png b/identicon/identicon.png Binary files differnew file mode 100644 index 0000000..8153c08 --- /dev/null +++ b/identicon/identicon.png diff --git a/identicon/poetry.lock b/identicon/poetry.lock new file mode 100644 index 0000000..932faf6 --- /dev/null +++ b/identicon/poetry.lock @@ -0,0 +1,53 @@ +[[package]] +name = "blockies" +version = "0.0.3" +description = "A tiny library for generating blocky identicons." +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +Pillow = "7.0.0" + +[[package]] +name = "pillow" +version = "7.0.0" +description = "Python Imaging Library (Fork)" +category = "main" +optional = false +python-versions = ">=3.5" + +[metadata] +lock-version = "1.1" +python-versions = "^3.11" +content-hash = "150e0247d42420ad12fb4e620fd53d5562e019cb9f162df89ea05ce1ec2185c0" + +[metadata.files] +blockies = [ + {file = "blockies-0.0.3-py3-none-any.whl", hash = "sha256:dfd211715ddef4bfc99f16ecfa55ca783494cd6a640986e1dc05b24b800d976d"}, + {file = "blockies-0.0.3.tar.gz", hash = "sha256:eb69415cd011e6b22635e3308c3bea16a6372af58d9c3c3aaa872751623a4fee"}, +] +pillow = [ + {file = "Pillow-7.0.0-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:5f3546ceb08089cedb9e8ff7e3f6a7042bb5b37c2a95d392fb027c3e53a2da00"}, + {file = "Pillow-7.0.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:9d2ba4ed13af381233e2d810ff3bab84ef9f18430a9b336ab69eaf3cd24299ff"}, + {file = "Pillow-7.0.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865"}, + {file = "Pillow-7.0.0-cp35-cp35m-win32.whl", hash = "sha256:c18f70dc27cc5d236f10e7834236aff60aadc71346a5bc1f4f83a4b3abee6386"}, + {file = "Pillow-7.0.0-cp35-cp35m-win_amd64.whl", hash = "sha256:875358310ed7abd5320f21dd97351d62de4929b0426cdb1eaa904b64ac36b435"}, + {file = "Pillow-7.0.0-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:ab76e5580b0ed647a8d8d2d2daee170e8e9f8aad225ede314f684e297e3643c2"}, + {file = "Pillow-7.0.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a62ec5e13e227399be73303ff301f2865bf68657d15ea50b038d25fc41097317"}, + {file = "Pillow-7.0.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:8ac6ce7ff3892e5deaab7abaec763538ffd011f74dc1801d93d3c5fc541feee2"}, + {file = "Pillow-7.0.0-cp36-cp36m-win32.whl", hash = "sha256:91b710e3353aea6fc758cdb7136d9bbdcb26b53cefe43e2cba953ac3ee1d3313"}, + {file = "Pillow-7.0.0-cp36-cp36m-win_amd64.whl", hash = "sha256:bf598d2e37cf8edb1a2f26ed3fb255191f5232badea4003c16301cb94ac5bdd0"}, + {file = "Pillow-7.0.0-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:5bfef0b1cdde9f33881c913af14e43db69815c7e8df429ceda4c70a5e529210f"}, + {file = "Pillow-7.0.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:dc058b7833184970d1248135b8b0ab702e6daa833be14035179f2acb78ff5636"}, + {file = "Pillow-7.0.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c5ed816632204a2fc9486d784d8e0d0ae754347aba99c811458d69fcdfd2a2f9"}, + {file = "Pillow-7.0.0-cp37-cp37m-win32.whl", hash = "sha256:54ebae163e8412aff0b9df1e88adab65788f5f5b58e625dc5c7f51eaf14a6837"}, + {file = "Pillow-7.0.0-cp37-cp37m-win_amd64.whl", hash = "sha256:87269cc6ce1e3dee11f23fa515e4249ae678dbbe2704598a51cee76c52e19cda"}, + {file = "Pillow-7.0.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0a628977ac2e01ca96aaae247ec2bd38e729631ddf2221b4b715446fd45505be"}, + {file = "Pillow-7.0.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:62a889aeb0a79e50ecf5af272e9e3c164148f4bd9636cc6bcfa182a52c8b0533"}, + {file = "Pillow-7.0.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:bf4003aa538af3f4205c5fac56eacaa67a6dd81e454ffd9e9f055fff9f1bc614"}, + {file = "Pillow-7.0.0-cp38-cp38-win32.whl", hash = "sha256:7406f5a9b2fd966e79e6abdaf700585a4522e98d6559ce37fc52e5c955fade0a"}, + {file = "Pillow-7.0.0-cp38-cp38-win_amd64.whl", hash = "sha256:5f7ae9126d16194f114435ebb79cc536b5682002a4fa57fa7bb2cbcde65f2f4d"}, + {file = "Pillow-7.0.0-pp373-pypy36_pp73-win32.whl", hash = "sha256:8453f914f4e5a3d828281a6628cf517832abfa13ff50679a4848926dac7c0358"}, + {file = "Pillow-7.0.0.tar.gz", hash = "sha256:4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946"}, +] diff --git a/identicon/pyproject.toml b/identicon/pyproject.toml new file mode 100644 index 0000000..18e3424 --- /dev/null +++ b/identicon/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "identicon" +version = "0.1.0" +description = "blockie identicon generator" +authors = ["terminaldweller <devi@terminaldweller.com>"] +license = "GPL3" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" +blockies = "^0.0.3" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" |