a
This commit is contained in:
parent
e250b4ca68
commit
f6be7ba070
2 changed files with 11 additions and 4 deletions
4
a.py
4
a.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('--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('--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('--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")
|
parser.add_argument('-i', '--image', type=str, default='1.png', help="input image")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
skip, slp, slp1, draw_img = args.skip, args.slp, args.slp1, args.drawfirst
|
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 = Image.open('dvd.png')
|
||||||
imgdvd = imgdvd.convert('RGBA')
|
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()
|
icmp6pkt = ICMP6(None, 0xad, 0, b'')._create_packet()
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
|
|
|
@ -4,8 +4,10 @@ import argparse
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)")
|
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('--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('--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('--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")
|
parser.add_argument('-i', '--image', type=str, default='1.png', help="input image")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
skip, slp, slp1, draw_img = args.skip, args.slp, args.slp1, args.drawfirst
|
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")
|
print(f"{1000*(end-start):.1f}ms {1000*(end-startsend):.1f}ms")
|
||||||
|
|
||||||
LANCZOS = Image.Resampling.LANCZOS if getattr(Image, 'Resampling', None) else Image.LANCZOS
|
LANCZOS = Image.Resampling.LANCZOS if getattr(Image, 'Resampling', None) else Image.LANCZOS
|
||||||
|
to_draw = Image.open(args.image).convert('RGBA').rotate(args.rotate).resize((X, Y), LANCZOS)
|
||||||
|
while True:
|
||||||
ldraw = img.copy()
|
ldraw = img.copy()
|
||||||
draw(Image.open(args.image).convert('RGBA').resize((X, Y), LANCZOS))
|
draw(to_draw)
|
||||||
print('success')
|
if not args.keepdrawing:
|
||||||
|
break
|
||||||
|
|
Loading…
Reference in a new issue