-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawGIF.py
28 lines (22 loc) · 836 Bytes
/
drawGIF.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from matrixflut import Endpoint, drawGIF, Offset
import sys
import argparse
import urllib.request
if __name__ == '__main__':
parser = argparse.ArgumentParser()
# parser.add_argument("host")
# parser.add_argument("port", type=int)
parser.add_argument("path")
parser.add_argument("-x", "--offsetx", type=int, default=0)
parser.add_argument("-y", "--offsety", type=int, default=0)
args = parser.parse_args()
if args.path.find("http") != -1:
with urllib.request.urlopen(args.path) as url:
with open('temp.jpg', 'wb') as f:
f.write(url.read())
args.path = 'temp.jpg'
endpoint = Endpoint("192.168.178.48", "1234")
# try:
drawGIF(endpoint, args.path, offset=Offset(args.offsetx, args.offsety), resize=True)
# except:
# print("Error")