mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-31 05:33:44 +00:00
Create imageCompressor.py
This commit is contained in:
parent
f75a7d28ee
commit
3df0d0769a
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