Create imageCompressor.py

This commit is contained in:
priddhesh 2022-09-25 22:08:23 +05:30 committed by GitHub
parent f4d0936ca1
commit e3cb07350d
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)