Make image resizer with python in 75 seconds
This blog presents the description of the video I uploaded on YouTube.
Video link: https://youtu.be/o6YzM0OKzMo
To make the image resizer, you need to first open visual studio or PyCharm.
Then in the terminal, write (pip install PILLOW)
PILLOW is the library for python image frameworks.
After installation is complete, copy and paste this code within the IDE and run the code.
from PIL import Image
from math import floor
myImgPath = input('Image path: ')
percentage = int(input('Resize percentage: '))
def resizeImg(img,percentage = 100):
myImg = Image.open(img)
sizedImg = myImg.resize(size = [int(myImg.size[0]*(percentage/100)),int(myImg.size[1]*(percentage/100))])
return sizedImg
resizeImg(myImgPath,percentage).show()
This code takes image path as an input and shows the resized image automatically.
Comments
Post a Comment