Simple Image Resizer

I recently was faced with a completely full hard drive on one of my PCs. I had a large collection of images that I needed to keep for future reference, but many of them were saved in their original high quality resolution and format. It wasn’t necessary for me to keep the original high quality files, and going through 1000s of images manually to resize was out of the question.

I was unable to find a program to quickly and automatically resize all the images in a given directory, so I wrote my own.

This simple python program uses pillow and pyautogui to:

  1. Ask the user to enter a resize percentage (0 to 100).
  2. Iterates through all PNG and JPEG objects in the root directory and resizes (overwrites original) based on the input from step 1.
  3. Skips any image that is already under 1MB in size.
  4. Reports to the user how many images were resized.

See the code snippet below, or the full project on Github –

#! python3
# - resizes all images in a folder based on user input

import os
import pyautogui as gui
from PIL import Image

# Prompt the user for the resize percentage
prompt = gui.prompt('What is the resize percent?')
scale = int(prompt)/100
count = 0

# Loop over all the files in the current directory
for filename in os.listdir('.'):
    if not (filename.endswith('.png') or filename.endswith('.jpg') or \
            filename.endswith('.PNG') or filename.endswith('.JPG') or \
            filename.endswith('.jpeg') or filename.endswith('.JPEG')):
        continue # skips files that are not images

    if os.stat(filename).st_size/1000 < 1024:
        continue # skips files that are under 1MB already
    im =
    width, height = im.size
    print("Risizing " + filename + "...")
    im = im.resize((int(width*scale), int(height*scale)))
    count += 1 # increment counter

print(str(count) + ' images resized.')
gui.alert(str(count) + ' images resized.', 'FINISHED!')

Download the free simple image resizer program below.

By downloading the and running the files below, you assume all responsibly for running and operating the software. and its proprietors assume no responsibility or liability for lost data, damaged systems, or corrupted information.


  1. Simply copy the .py or .exe into the folder containing images
  2. Double click the .py or .exe to launch the program.
  3. Enter the resize percentage in the pop up box (0-100) with no “%” sign.
  4. Sit back for a few seconds to a few minutes, depending on the number of images.
  5. Click Ok on the pop telling you how many images were resized.
  6. Enjoy your new found hard drive space.