The perfect helper for shrinking your JPG images – because sometimes less really is more!
compress-jpg is a simple yet handy Python script that lets you shrink JPG images to your desired size (by percentage). Just provide the path to your image, choose where to save the result, and specify the percentage for resizing. Done! 🏆
No more overly large images in emails, presentations, or on your website! 🚀
All the magic happens in compress.py:
- Uses the Pillow (PIL) library for image manipulation
- Shrinks images based on the user-defined percentage
- Saves the result as a new JPG file
- If you enter 100% or more, the image won’t be changed (because we know our math 😄)
- Clone the repository:
git clone https://github.com/hrosicka/compress-jpg.git cd compress-jpg - Install the required packages:
pip install Pillow
Run the script in your terminal:
python compress.pyAnd then just follow the on-screen instructions:
- Enter the path to your input JPG file (don’t worry, it won’t bite! 🦷)
- Specify where to save the output file
- Enter the resizing percentage (e.g., 50 for half the size)
Enter the path to the input JPG image: /path/to/your/image.jpg
Enter the path to save the resized image (including the .jpg filename): /path/to/output/image_small.jpg
Enter the resizing percentage (e.g., 50 for 50%): 50
The image was resized by 50% and saved to: /path/to/output/image_small.jpg
- Does it support only JPG? Yes, for now it’s a JPG specialist. PNG and other formats are still waiting for their time to shine.
- What if I enter 100% or more? The script will let you know and won’t resize the image – because sometimes 100% is just enough!
Lovingly crafted by Hanka Robovska 👩🔬
MIT – feel free to use, modify, and share as your heart desires! 😉
Shrink wisely. Every byte counts! 🧮✨