This commit is contained in:
JerryXiao 2023-03-10 16:17:46 +08:00
parent 7ab17d8e71
commit f63edde3ab
3 changed files with 16 additions and 4 deletions

12
a.py
View file

@ -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')

View file

@ -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')

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('-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)