mirror of
https://github.com/e1ven/Robohash.git
synced 2025-06-23 21:35:02 +00:00
commit
bb904862a8
26
robohash/cli.py
Normal file
26
robohash/cli.py
Normal file
@ -0,0 +1,26 @@
|
||||
import argparse
|
||||
import io
|
||||
import sys
|
||||
from robohash import Robohash
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-s", "--set", default="set1")
|
||||
parser.add_argument("-x", "--width", type=int, default=300)
|
||||
parser.add_argument("-y", "--height", type=int, default=300)
|
||||
parser.add_argument("-f", "--format", default="png")
|
||||
parser.add_argument("-b", "--bgset")
|
||||
parser.add_argument("-o", "--output", default="robohash.png")
|
||||
parser.add_argument("text", help="Text to use for the hash")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
robohash = Robohash(args.text)
|
||||
robohash.assemble(roboset=args.set, bgset=args.bgset,
|
||||
sizex=args.width, sizey=args.height)
|
||||
|
||||
robohash.img.save(args.output, format=args.format)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user