Create imageCompressor.py

This commit is contained in:
priddhesh 2022-09-25 21:38:45 +05:30 committed by GitHub
parent f75a7d28ee
commit 3df0d0769a
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)