image resize
This script is designed to resize images in a specified directory using Python and the Pillow library. It iterates through all files in the directory, checks if they are images, and then resizes them according to a specified compression ratio. The resized images are saved in a different directory. it can be used for creating thumbnails or compressing image
- Ensure you have Python 3.x installed on your system.
- Install the Pillow library using pip:
-
Place your images in the
source
directory. -
Modify the
compression_ratio
variable in the script to adjust the size of the resized images. A value of 1 will keep the original size, values greater than 1 will enlarge the images, and values less than 1 will reduce the images. -
Run the script:
-
The resized images will be saved in the
resized
directory.