Create convert2jpg.py

This commit is contained in:
Jagdamba Tripathi 2022-10-16 01:18:39 +05:30 committed by GitHub
parent 4eda20bccd
commit e37961483b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 <file>")
"""
To run it use:
convert2jpg test.png
"""