Create imageCompressor.py

This commit is contained in:
priddhesh 2022-09-25 23:13:50 +05:30 committed by GitHub
parent f0c04833b8
commit 81eef1c746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,16 @@
from PIL import Image
from tkinter.filedialog import *
import argparse
def compressImage(filename):
img = Image.open(filename)
myHeight, myWidth = img.size
img = img.resize((myHeight,myWidth), Image.ANTIALIAS)
img.save("compressed-"+filename)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("img",type = str)
args = parser.parse_args()
compressImage(args.img)