File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
IMAGES & PHOTO SCRIPTS/Image-Inverter Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,24 @@ def main():
1414 """ The main function """
1515 check_input ()
1616
17+ verbose_enabled = False
18+ if ("-v" in sys .argv ) or ("--verbose" in sys .argv ):
19+ verbose_enabled = True
20+
1721 i = 0
1822 for file in sys .argv :
19- # To ignore the first parameter -> the script call
20- if i == 0 :
23+ # To ignore the first parameter -> the script call + -v + --verbose
24+ if i == 0 or sys . argv [ i ] == "-v" or sys . argv [ i ] == "--verbose" :
2125 i = i + 1
2226 continue
2327
2428 image_path_no_ext , extension = os .path .splitext (file )
2529
2630 with Image .open (file ) as image :
27- ImageOps .invert (image ).save (image_path_no_ext + "_inverted" + extension )
31+ new_path_with_ext = image_path_no_ext + "_inverted" + extension
32+ ImageOps .invert (image ).save (new_path_with_ext )
33+ if verbose_enabled :
34+ print ("Successfully inverted " + file + "\n " + new_path_with_ext + " is generated.\n " )
2835
2936 i = i + 1
3037
You can’t perform that action at this time.
0 commit comments