mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Merge pull request #320 from niranjanneeru/master
fix : #259 ANTIALIAS changed to LANCZOS
This commit is contained in:
commit
fc2e323ba9
|
@ -2,11 +2,18 @@ import PIL
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from tkinter.filedialog import *
|
from tkinter.filedialog import *
|
||||||
|
|
||||||
file_path=askopenfilenames()
|
file_paths = askopenfilenames()
|
||||||
img = PIL.Image.open(file_path)
|
|
||||||
myHeight,myWidth = img.size
|
|
||||||
|
|
||||||
img=img.resize((myHeight,myWidth),PIL.Image.ANTILIAS)
|
if len(file_paths) == 0:
|
||||||
save_path=asksaveasfile()
|
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}")
|
|
@ -7,5 +7,7 @@ It automates the task of compressing the image in day to day lives.
|
||||||
|
|
||||||
# Dependencies:
|
# Dependencies:
|
||||||
|
|
||||||
pip install image
|
Note : Use python3.11 for tkinder
|
||||||
|
|
||||||
|
`pip install pillow`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user