mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
fix : #259 AttributeError fixed
This commit is contained in:
parent
b652b9f602
commit
f66126186b
|
@ -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}")
|
Loading…
Reference in New Issue
Block a user