Now using argparse.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 3 Jun 2019 20:57:13 +0000 (22:57 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 3 Jun 2019 20:57:13 +0000 (22:57 +0200)
gimp_passport.py

index 17d8f5f..da046ee 100644 (file)
@@ -1,3 +1,4 @@
+import argparse
 from PIL import Image
 
 def make_passport(image_filename: str, fpr: float, width_mm: float, height_mm: float) -> Image:
@@ -32,9 +33,16 @@ def make_passport(image_filename: str, fpr: float, width_mm: float, height_mm: f
     return pic
 
 
-def main():
-    pic = make_passport('test_image.png', 0.75, 35., 45.)
-    pic.save('x.png')
+def main(source_image: str, dest_image: str):
+    pic = make_passport(source_image, 0.75, 35., 45.)
+    pic.save(dest_image)
 
 
-main()
+if __name__ == '__main__':
+    description = 'Convert image with alpha mask marking the face to passport image.'
+    parser = argparse.ArgumentParser(description=description)
+    parser.add_argument('source', help='sourse image')
+    parser.add_argument('dest', help='destination image')
+    args = parser.parse_args()
+    main(args.source, args.dest)
+