diff --git a/a.py b/a.py index b6e8daa..4166cb0 100644 --- a/a.py +++ b/a.py @@ -1,3 +1,13 @@ +import argparse +parser = argparse.ArgumentParser() +parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)") +parser.add_argument('--drawfirst', action='store_true', help="draw image first (unused)") +parser.add_argument('--slp', type=float, default=0.0001, help="sleep x seconds after each ping") +parser.add_argument('--slp1', type=float, default=0.5, help="sleep x seconds after each frame") +parser.add_argument('-i', '--image', type=str, default='1.png', help="input image") +args = parser.parse_args() +skip, slp, slp1, draw_img = args.skip, args.slp, args.slp1, args.drawfirst + import struct class ICMP6: _ICMP_ECHO_REQUEST = 128 @@ -67,7 +77,7 @@ Y=512 import socket, traceback, time from PIL import Image -#img = Image.open('1.png') +#img = Image.open(args.image) #img = img.resize((X, Y), Image.Resampling.LANCZOS) #img.save('out.png') #img = img.convert('RGBA') diff --git a/draw-gen3.py b/draw-gen3.py index 62a41a4..d71f255 100644 --- a/draw-gen3.py +++ b/draw-gen3.py @@ -6,6 +6,7 @@ parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)") parser.add_argument('--drawfirst', action='store_true', help="draw image first (unused)") parser.add_argument('--slp', type=float, default=0.0001, help="sleep x seconds after each ping") parser.add_argument('--slp1', type=float, default=0.5, help="sleep x seconds after each frame") +parser.add_argument('-i', '--image', type=str, default='1.png', help="input image") args = parser.parse_args() skip, slp, slp1, draw_img = args.skip, args.slp, args.slp1, args.drawfirst @@ -154,5 +155,5 @@ def draw(img): print(f"{1000*(end-start):.1f}ms {1000*(end-startsend):.1f}ms") ldraw = img.copy() -draw(Image.open('1.png').convert('RGBA').resize((X, Y), Image.Resampling.LANCZOS)) +draw(Image.open(args.image).convert('RGBA').resize((X, Y), Image.Resampling.LANCZOS)) print('success') diff --git a/gen3.py b/gen3.py index fb68743..5251b12 100644 --- a/gen3.py +++ b/gen3.py @@ -4,6 +4,7 @@ parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)") parser.add_argument('--drawfirst', action='store_true', help="draw image first (unused)") parser.add_argument('--slp', type=float, default=0.0001, help="sleep x seconds after each ping") parser.add_argument('--slp1', type=float, default=0.5, help="sleep x seconds after each frame") +parser.add_argument('-i', '--image', type=str, default='1.png', help="input image") args = parser.parse_args() skip, slp, slp1, draw_img = args.skip, args.slp, args.slp1, args.drawfirst @@ -76,7 +77,7 @@ Y=512 import socket, traceback, time from PIL import Image -#img = Image.open('1.png') +#img = Image.open(args.image) #img = img.resize((X, Y), Image.Resampling.LANCZOS) #img.save('out.png') #img = img.convert('RGBA') @@ -201,7 +202,7 @@ def draw(img): print(f"{1000*(end-start):.1f}ms {1000*(end-startsend):.1f}ms") ldraw = img.copy() -draw(Image.open('1.png').convert('RGBA').resize((X, Y), Image.Resampling.LANCZOS)) +draw(Image.open(args.image).convert('RGBA').resize((X, Y), Image.Resampling.LANCZOS)) print('success') exit(0)