Resizing an image to smaller size
Resizing images to smaller dimension to satisfy the file size or height/width requirements is something we have faced multiple times. Most of the online tools which I previously used were full of advertisments, and even required to login which is something I hated a lot. Today I learned to do this tedious job with python and it's pretty easy also.
Library used: Pillow
Save file as resize.py
and run the script with:
python3 resize.py image.jpg
Thanks to Jishnu and Rajeesh, I learned there is another tool called ImageMagick. It can also resize images, along with a ton more other cool stuff.
Try image magic, I think it is built into most distros (if not, easy to install via system package manager) and supports more than 200 formats. Easy to use as well.— Jishnu (@jishnu7) July 20, 2021
To Install ImageMagick in your debian based distro:
To resize images with height, width use the option:
You can resize also based on the quality as follows: