From e37961483b30d2894251061219ce316eb57bccb4 Mon Sep 17 00:00:00 2001 From: Jagdamba Tripathi <54079135+jagdtri2003@users.noreply.github.com> Date: Sun, 16 Oct 2022 01:18:39 +0530 Subject: [PATCH] Create convert2jpg.py --- scripts/Convert-to-jpg/convert2jpg.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/Convert-to-jpg/convert2jpg.py diff --git a/scripts/Convert-to-jpg/convert2jpg.py b/scripts/Convert-to-jpg/convert2jpg.py new file mode 100644 index 0000000..a09a316 --- /dev/null +++ b/scripts/Convert-to-jpg/convert2jpg.py @@ -0,0 +1,23 @@ +import os +import sys +from PIL import Image + +if len(sys.argv) > 1: + if os.path.exists(sys.argv[1]): + im = Image.open(sys.argv[1]) + target_name = sys.argv[1] + ".jpg" + rgb_im = im.convert('RGB') + rgb_im.save(target_name) + print("Saved as " + target_name) + else: + print(sys.argv[1] + " not found") +else: + print("Usage: convert2jpg.py ") + + +""" + To run it use: + + convert2jpg test.png + +"""