add invert flag

This commit is contained in:
interfisch 2023-12-31 15:29:28 +01:00
parent 946b1f255d
commit 1e6036cde4
1 changed files with 5 additions and 1 deletions

View File

@ -11,9 +11,10 @@ parser.add_argument('filename') # positional argument
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')
args = parser.parse_args()
print(args.filename, args.output, args.format,args.verbose)
print(args.filename, args.output, args.format,args.verbose,args.invert)
im = Image.open(args.filename) # Can be many different formats.
@ -73,6 +74,9 @@ with open('result.txt', 'w') as f:
columnValue=0
for y in reversed(range(im.size[1])):
c = pix[x,y] #get pixel
if args.invert:
c=255-c
if (c[0]>127):
if output_col_write_binary_flag:
f.write("1")