This commit is contained in:
JerryXiao 2023-03-10 17:29:43 +08:00
parent e250b4ca68
commit f6be7ba070
2 changed files with 11 additions and 4 deletions

4
a.py
View File

@ -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('--rotate', type=int, default=0, help="rotate image for x deg")
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
@ -72,7 +73,8 @@ from PIL import Image
imgdvd = Image.open('dvd.png')
imgdvd = imgdvd.convert('RGBA')
#imgdvd = imgdvd.rotate(180)
if args.rotate == 180:
imgdvd = imgdvd.rotate(args.rotate)
icmp6pkt = ICMP6(None, 0xad, 0, b'')._create_packet()
import concurrent.futures

View File

@ -4,8 +4,10 @@ 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('--keepdrawing', action='store_true', help="keepdrawing, sleep for slp1")
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('--rotate', type=int, default=0, help="rotate image for x deg")
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
@ -155,6 +157,9 @@ def draw(img):
print(f"{1000*(end-start):.1f}ms {1000*(end-startsend):.1f}ms")
LANCZOS = Image.Resampling.LANCZOS if getattr(Image, 'Resampling', None) else Image.LANCZOS
ldraw = img.copy()
draw(Image.open(args.image).convert('RGBA').resize((X, Y), LANCZOS))
print('success')
to_draw = Image.open(args.image).convert('RGBA').rotate(args.rotate).resize((X, Y), LANCZOS)
while True:
ldraw = img.copy()
draw(to_draw)
if not args.keepdrawing:
break