diff --git a/imagegenerator/generate.py b/imagegenerator/generate.py index 91ef0a8..a3befd1 100644 --- a/imagegenerator/generate.py +++ b/imagegenerator/generate.py @@ -12,9 +12,11 @@ parser.add_argument('-o', '--output') # option that takes a value parser.add_argument('-f', '--format', choices=['firmware','nodered','nodered_int'], default='firmware', help='Output format') # option that takes a value parser.add_argument('-v', '--verbose', action='store_true') # on/off flag parser.add_argument('-i', '--invert', action='store_true') +parser.add_argument('-y', '--ymirror', action='store_true') +parser.add_argument('-x', '--xmirror', action='store_true') args = parser.parse_args() -print(args.filename, args.output, args.format,args.verbose,args.invert) +print(args.filename, args.output, args.format,args.verbose,args.invert,args.xmirror,args.ymirror) outputfilename="result.txt" if args.output is not None: @@ -60,6 +62,8 @@ elif args.format=='nodered_int': #Nodered Int +xrange = range(im.size[0]) +yrange = range(im.size[1]) def calculateDistance(x1,y1,x2,y2): @@ -68,22 +72,35 @@ def calculateDistance(x1,y1,x2,y2): with open(outputfilename, 'w') as f: f.write(output_pre) - for x in range(im.size[0]): + _xrange=xrange + if args.xmirror: + _xrange=reversed(xrange) + for ix,x in enumerate(_xrange): + if args.verbose: + print("ix="+str(ix)+" x="+str(x)) f.write(output_col_preL) if output_col_writeCol_flag: f.write(str(x)) f.write(output_col_preR) columnValue=0 - for y in reversed(range(im.size[1])): + + _yrange=yrange + if args.ymirror: + _yrange=reversed(yrange) + for iy,y in enumerate(_yrange): + if args.verbose: + print("iy="+str(iy)+" y="+str(y)) c = pix[x,y] #get pixel + if args.verbose: + print("get pixel "+str(x)+","+str(y)+": color="+str(c)) if args.invert: c=255-c if (c[0]>127): if output_col_write_binary_flag: f.write("1") - columnValue+=pow(2,y) + columnValue+=pow(2,iy) else: if output_col_write_binary_flag: f.write("0") diff --git a/imagegenerator/numbers/0.txt b/imagegenerator/numbers/0.txt new file mode 100644 index 0000000..be1279d --- /dev/null +++ b/imagegenerator/numbers/0.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111111111000\ +0001000000000100\ +0010001111100010\ +0010010000010010\ +0010010000010010\ +0010010000010010\ +0010001111100010\ +0001000000000100\ +0000111111111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/1.txt b/imagegenerator/numbers/1.txt new file mode 100644 index 0000000..f9742a7 --- /dev/null +++ b/imagegenerator/numbers/1.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000000000000000\ +0000111000001110\ +0001001000001010\ +0010011111111010\ +0010000000000010\ +0011111111111010\ +0000000000001010\ +0000000000001110\ +0000000000000000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/2.txt b/imagegenerator/numbers/2.txt new file mode 100644 index 0000000..aedda56 --- /dev/null +++ b/imagegenerator/numbers/2.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111000011110\ +0001001000100010\ +0010011001000010\ +0010100010000010\ +0010111100011010\ +0010000000101010\ +0010000001001010\ +0001111110001110\ +0000000000000000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/3.txt b/imagegenerator/numbers/3.txt new file mode 100644 index 0000000..41eaada --- /dev/null +++ b/imagegenerator/numbers/3.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111000111000\ +0001001000100100\ +0010001000100010\ +0010011010110010\ +0010100101001010\ +0010011000110010\ +0010000010000010\ +0001000101000100\ +0000111000111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/4.txt b/imagegenerator/numbers/4.txt new file mode 100644 index 0000000..3ea4ba2 --- /dev/null +++ b/imagegenerator/numbers/4.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0011111111100000\ +0010000000100000\ +0011111110100000\ +0000000010100000\ +0000011110111110\ +0000010000000010\ +0000011110111110\ +0000000010100000\ +0000000011100000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/5.txt b/imagegenerator/numbers/5.txt new file mode 100644 index 0000000..97c6dbf --- /dev/null +++ b/imagegenerator/numbers/5.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0011111100111000\ +0010000100100100\ +0010000100100010\ +0010110100110010\ +0010110010001010\ +0010101001110010\ +0010101000000010\ +0010101000000100\ +0011100111111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/6.txt b/imagegenerator/numbers/6.txt new file mode 100644 index 0000000..5f6bea4 --- /dev/null +++ b/imagegenerator/numbers/6.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111111111000\ +0001000000000100\ +0010000000000010\ +0010011101111010\ +0010100101001010\ +0010100101001010\ +0010010100110010\ +0001010100000100\ +0000110011111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/7.txt b/imagegenerator/numbers/7.txt new file mode 100644 index 0000000..48356d3 --- /dev/null +++ b/imagegenerator/numbers/7.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0011100000000000\ +0010100000000000\ +0010100011111110\ +0010100100000010\ +0010101000111110\ +0010110001000000\ +0010000010000000\ +0010000100000000\ +0011111000000000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/8.txt b/imagegenerator/numbers/8.txt new file mode 100644 index 0000000..b24696e --- /dev/null +++ b/imagegenerator/numbers/8.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111000111000\ +0001000101000100\ +0010010010010010\ +0010101000101010\ +0010101000101010\ +0010101000101010\ +0010010010010010\ +0001000101000100\ +0000111000111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/9.txt b/imagegenerator/numbers/9.txt new file mode 100644 index 0000000..ec5797a --- /dev/null +++ b/imagegenerator/numbers/9.txt @@ -0,0 +1,12 @@ +msg.payload="\ +0000111110011000\ +0001000001010100\ +0010011001010010\ +0010100101001010\ +0010100101001010\ +0010111101110010\ +0010000000000010\ +0001000000000100\ +0000111111111000\ +"; +return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/0.txt b/imagegenerator/numbers/retrostyle_isolated/0.txt deleted file mode 100644 index 3476cac..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/0.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001111111110000\ -0010000000001000\ -0100011111000100\ -0100100000100100\ -0100100000100100\ -0100100000100100\ -0100011111000100\ -0010000000001000\ -0001111111110000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/1.txt b/imagegenerator/numbers/retrostyle_isolated/1.txt deleted file mode 100644 index f480d9f..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/1.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0000000000000000\ -0111000001110000\ -0101000001001000\ -0101111111100100\ -0100000000000100\ -0101111111111100\ -0101000000000000\ -0111000000000000\ -0000000000000000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/2.txt b/imagegenerator/numbers/retrostyle_isolated/2.txt deleted file mode 100644 index 69a1b5d..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/2.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0111100001110000\ -0100010001001000\ -0100001001100100\ -0100000100010100\ -0101100011110100\ -0101010000000100\ -0101001000000100\ -0111000111111000\ -0000000000000000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/3.txt b/imagegenerator/numbers/retrostyle_isolated/3.txt deleted file mode 100644 index b9931f3..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/3.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001110001110000\ -0010010001001000\ -0100010001000100\ -0100110101100100\ -0101001010010100\ -0100110001100100\ -0100000100000100\ -0010001010001000\ -0001110001110000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/4.txt b/imagegenerator/numbers/retrostyle_isolated/4.txt deleted file mode 100644 index 936f5e8..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/4.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0000011111111100\ -0000010000000100\ -0000010111111100\ -0000010100000000\ -0111110111100000\ -0100000000100000\ -0111110111100000\ -0000010100000000\ -0000011100000000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/5.txt b/imagegenerator/numbers/retrostyle_isolated/5.txt deleted file mode 100644 index 73d9194..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/5.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001110011111100\ -0010010010000100\ -0100010010000100\ -0100110010110100\ -0101000100110100\ -0100111001010100\ -0100000001010100\ -0010000001010100\ -0001111110011100\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/6.txt b/imagegenerator/numbers/retrostyle_isolated/6.txt deleted file mode 100644 index f8cacd1..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/6.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001111111110000\ -0010000000001000\ -0100000000000100\ -0101111011100100\ -0101001010010100\ -0101001010010100\ -0100110010100100\ -0010000010101000\ -0001111100110000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/7.txt b/imagegenerator/numbers/retrostyle_isolated/7.txt deleted file mode 100644 index efa770a..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/7.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0000000000011100\ -0000000000010100\ -0111111100010100\ -0100000010010100\ -0111110001010100\ -0000001000110100\ -0000000100000100\ -0000000010000100\ -0000000001111100\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/8.txt b/imagegenerator/numbers/retrostyle_isolated/8.txt deleted file mode 100644 index b1f03ea..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/8.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001110001110000\ -0010001010001000\ -0100100100100100\ -0101010001010100\ -0101010001010100\ -0101010001010100\ -0100100100100100\ -0010001010001000\ -0001110001110000\ -"; -return msg; \ No newline at end of file diff --git a/imagegenerator/numbers/retrostyle_isolated/9.txt b/imagegenerator/numbers/retrostyle_isolated/9.txt deleted file mode 100644 index ec79b8a..0000000 --- a/imagegenerator/numbers/retrostyle_isolated/9.txt +++ /dev/null @@ -1,12 +0,0 @@ -msg.payload="\ -0001100111110000\ -0010101000001000\ -0100101001100100\ -0101001010010100\ -0101001010010100\ -0100111011110100\ -0100000000000100\ -0010000000001000\ -0001111111110000\ -"; -return msg; \ No newline at end of file