Merge pull request #320 from niranjanneeru/master

fix : #259 ANTIALIAS changed to LANCZOS
This commit is contained in:
Ayush Bhardwaj 2023-10-02 10:49:51 +02:00 committed by GitHub
commit fc2e323ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -2,11 +2,18 @@ import PIL
from PIL import Image
from tkinter.filedialog import *
file_path=askopenfilenames()
img = PIL.Image.open(file_path)
myHeight,myWidth = img.size
file_paths = askopenfilenames()
img=img.resize((myHeight,myWidth),PIL.Image.ANTILIAS)
save_path=asksaveasfile()
if len(file_paths) == 0:
print("No Files Selected")
img.save(save_path+"_compressed.JPG")
for file in file_paths:
file_name = file.split('/')[-1]
file_name, extension = file_name.split('.')
img = PIL.Image.open(file)
height,width = img.size
img=img.resize((height,width),Image.Resampling.LANCZOS)
save_path=askdirectory()
img.save(save_path+f"/{file_name}_compressed.{extension}")

View File

@ -7,5 +7,7 @@ It automates the task of compressing the image in day to day lives.
# Dependencies:
pip install image
Note : Use python3.11 for tkinder
`pip install pillow`