mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-24 04:21:12 +00:00
17 lines
429 B
Python
17 lines
429 B
Python
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)
|