This Python script resizes images in bulk from an input folder to a specified size and saves them in an output folder. The script supports .jpg, .jpeg, and .png image formats. It's useful for resizing large numbers of images quickly and easily.
- Resizes multiple images in a batch.
- Supports
.jpg,.jpeg, and.pngfile formats. - Resize to exact dimensions.
- Saves resized images in a separate output folder.
- Python 3.x
Pillowlibrary (Python Imaging Library)
-
Install Python: Ensure Python 3.x is installed on your system. You can download it from python.org.
-
Install Pillow Library: Install the required Python library using pip.
pip install pillow
-
Set the following variables in the script:
INPUT_FOLDER: Directory containing the images you want to resize.OUTPUT_FOLDER: Directory where the resized images will be saved.NEW_SIZE: The new dimensions to which the images will be resized (width, height).
-
The script will resize all images in the
INPUT_FOLDERto the dimensions specified inNEW_SIZEand save them in theOUTPUT_FOLDER.
-
Prepare your images: Place all the images you want to resize in the
input_imagesfolder (or the folder specified in theINPUT_FOLDERvariable). -
Run the script:
python app.py
The script will process all
.jpg,.jpeg, and.pngimages in the input folder, resize them, and save them in the output folder. -
Output Folder: After running the script, you'll find the resized images in the
output_imagesfolder (or the folder specified in theOUTPUT_FOLDERvariable).
input_images/
image1.jpg
image2.png
image3.jpeg
output_images/
image1.jpg
image2.png
image3.jpeg
- The script automatically creates the output folder (
output_images) if it does not exist. - All images are resized to the exact dimensions specified in the
NEW_SIZEvariable. - It will process all images in the
INPUT_FOLDERthat have.jpg,.jpeg, or.pngextensions.
This script is free to use under the MIT License.