mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-27 14:01:12 +00:00
Create imageCompressor.py
This commit is contained in:
parent
f0c04833b8
commit
81eef1c746
16
scripts/ImageCompressor/imageCompressor.py
Normal file
16
scripts/ImageCompressor/imageCompressor.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user