ImageAdjuster is a small Python CLI that resizes images, converts between JPG and PNG, and searches for an output quality that lands inside a target file-size range.
- Upscales images that are smaller than your minimum width or height requirements
- Converts output to
jpgorpng - Iterates over quality settings to try to fit the output into a desired size window
- Writes the adjusted image next to the original file with an
_adjustedsuffix
- Python
- Pillow
git clone https://github.com/ShanedevPro/ImageAdjuster.git
cd ImageAdjuster
pip install -r requirements.txtpython adjust_image.py ./input/photo.pngThis uses the default rules:
- minimum width:
360 - minimum height:
480 - output format:
jpg - file size target:
20 KBto200 KB
python adjust_image.py ./input/photo.png --width 800 --height 600 --format jpgpython adjust_image.py ./input/photo.png --format png --min_size 80 --max_size 120- The tool increases image size when the source image is smaller than the target minimum resolution.
- It only supports
jpgandpngoutputs. - If no quality setting can satisfy the requested size range, the script prints a warning instead of forcing an output.
If the input file is photo.png, the adjusted file is written as:
photo_adjusted.jpg
or
photo_adjusted.png
depending on the selected output format.
MIT