Shrinking 16 GB to 1.9 GB with Python - Image Compression!

Shrinking 16 GB to 1.9 GB with Python - Image Compression!

Have you ever worked with thousands of high-res images and struggled with storage issues?

Recently, I faced a challenge — 1200+ images totalling ~16 GB. After a bit of Python magic and some fine-tuning, I compressed them all down to just 1.9 GB, with virtually no noticeable loss in quality.

What I Built

A Python-based image compression tool that:

  • Compresses images in bulk (JPEG/PNG)

  • Shrinks file size by up to 85-90%

  • Maintains high visual quality

  • Processes hundreds or thousands of files easily

  • It was developed and tested in Jupyter Notebook

A quick look at how it works:

I wrapped this in a script that loops through entire folders, handles different image modes (RGB, RGBA, P), and catches errors gracefully.

The Result?

  • 📸 Originals: 1200+ images (~12–15 MB each)

  • 🗜️ After Compression: ~1 MB per image

  • 💾 Space Saved: ~14 GB

  • ⏱️ Time Taken: Just a few minutes to run!

Why This Matters

Whether you're building a web app, working with datasets, or just want to free up disk space, efficient image compression can make a huge difference in speed, cost, and scalability.

This project is perfect for:

  • Data scientists working with image datasets

  • Web developers need optimised media

  • Anyone who needs to compress images in bulk

Check It Out

🧠 Full project, code, and explanation available on my GitHub: github.com/surajsoni1319/Python-Projects

Feel free to star ⭐ the repo if you find it helpful!

To view or add a comment, sign in

Others also viewed

Explore topics