fix : #259 AttributeError fixed

This commit is contained in:
Niranjan B 2023-09-29 16:16:07 +05:30
parent b652b9f602
commit f66126186b

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),Image.Resampling.LANCZOS)
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}")