mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2025-02-07 00:50:54 +00:00
parent
7784de4959
commit
f1ba8a5c95
|
@ -16,14 +16,49 @@ import PIL
|
|||
from PIL import Image
|
||||
from tkinter.filedialog import *
|
||||
|
||||
file_path=askopenfilenames()
|
||||
file_path = askopenfilenames()
|
||||
img = PIL.Image.open(file_path)
|
||||
myHeight,myWidth = img.size
|
||||
myHeight, myWidth = img.size
|
||||
|
||||
img = img.resize((myHeight, myWidth), PIL.Image.ANTILIAS)
|
||||
save_path = asksaveasfile()
|
||||
|
||||
img.save(save_path + "_compressed.JPG")
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
from tkinter.filedialog import *
|
||||
|
||||
file_path = askopenfilenames()
|
||||
img = PIL.Image.open(file_path)
|
||||
myHeight, myWidth = img.size
|
||||
|
||||
img = img.resize((myHeight, myWidth), PIL.Image.ANTILIAS)
|
||||
save_path = asksaveasfile()
|
||||
|
||||
img.save(save_path + "_compressed.JPG")
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
from tkinter.filedialog import *
|
||||
|
||||
file_paths = askopenfilenames()
|
||||
|
||||
if len(file_paths) == 0:
|
||||
print("No Files Selected")
|
||||
|
||||
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}")
|
||||
|
||||
img=img.resize((myHeight,myWidth),PIL.Image.ANTILIAS)
|
||||
save_path=asksaveasfile()
|
||||
|
||||
img.save(save_path+"_compressed.JPG")
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
|
|
Loading…
Reference in New Issue
Block a user