Python to Terminal Progress Bar with Image Resizing with Full Source Code For Beginners

Here I just take the example of image resizing for displaying a progress bar. When we convert lots of images at a time we can use a progress bar to show how many images are resized.


  • For this purpose I am using tqdm librabry
  • This Library is for showing a progress bar
pip install tqdm
  • For Resizing images
pip install Pillow

Source Code:


from tqdm import tqdm
from PIL import Image
import os
from time import sleep

def Resize_image(size, image):
    if os.path.isfile(image):
            im =
            im.thumbnail(size, Image.ANTIALIAS)
  "resize/" + str(image) + ".jpg")
        except Exception as ex:
            print(f"Error: {str(ex)} to {image}")

path = input("Enter Path to images : ")
size = input("Size Height , Width : ")
size = tuple(map(int, size.split(",")))


list_images = os.listdir(path)
if "resize" not in list_images:

for image in tqdm(list_images, desc="Resizing Images"):
    Resize_image(size, image)
print("Resizing Completed!")Code language: JavaScript (javascript)

Leave a Comment