Skip to content

sbauer0/imgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Scaler

Simple python command-line script that scales images to the targeted file size with minumum quality loss and preserving aspect ratio.

The script works by converting images to bitmaps and using a binary search to find the highest possible resolution that stays under the specified file size. Is it efficient? Not really. Is it simple? Definitely. If you just need to email images and stay within file size limits, it gets the job done.

Acceptable formats: .jpg, .jpeg, .png, .webp.

Usage Examples

Scale a single image to 1 MB:

./imgs input.jpg 1

Scale multiple images to 0.5 MB each:

./imgs photo1.jpg photo2.jpg 0.5

Scale all .png files in the current directory to 0.8 MB and save them in the output/ folder:

./imgs *.png 0.8 -o output/

License

This project is licensed under the GNU General Public License v3.0 – see the LICENSE file for details.

Author

Developed by Stefan Bauer © 2025 Stefan Bauer. Licensed under GNU GPL v3.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages