python-scripts/scripts/Image_resizer/resize.py

11 lines
416 B
Python
Raw Normal View History

2022-10-05 05:10:16 +00:00
from PIL import Image as img
import os
file_name = input("Enter anpe of file: ")
name , ext = file_name.split('.')
pic = img.open((os.path.join(os.path.dirname(os.path.abspath(__file__)),file_name)))
ht, wt= input("Enter dimenstions(eg: 1024x720): ").split('x')
dim = int(ht), int(wt)
img_resize = pic.resize(dim)
img_resize.save((os.path.join(os.path.dirname(os.path.abspath(__file__)),f'{name}_resized.{ext}')))