I'm always excited to take on new projects and collaborate with innovative minds.

Phone

+91 93215 94759

Email

coffee@abhisat.com

Website

https://abhisat.com

Social Links

Python

Image Extractor Tool from Folders

A lightweight Python tool that extracts all `.jpg`, `.jpeg`, and `.png` images from a selected folder (including subfolders), and copies them into a new folder named `extracted_images`. Duplicate image names are automatically renamed to avoid overwriting.

Image Extractor Tool from Folders

πŸ–ΌοΈ Build a Python Tool to Extract and Rename All Images from Any Folder

Have you ever had to sift through dozens (or hundreds!) of folders just to collect a bunch of images scattered everywhere? Maybe you’re organizing a design project, cleaning up your downloads, or collecting assets for a presentation. Doing this manually is a total drag β€” and that’s exactly why I built this tool!

πŸ’‘ What Is It?

Image Extractor Tool is a small Python utility that lets you select any folder and automatically extracts all .jpg, .jpeg, and .png files β€” even from subfolders. All the found images are neatly copied into a new folder called extracted_images.

And the best part? If there are duplicate filenames (like multiple cat.jpg files), the tool renames them smartly to cat_1.jpg, cat_2.jpg, and so on. No overwrites, no headaches!

Β 

πŸ› οΈ Why I Built This

While checking on my archived college images, I saw tons of images in different folders with duplicate names. I needed a way to:

  • Collect them all in one place,
  • Keep the original files untouched,
  • Avoid overwriting files with the same name.

Instead of doing it manually, I thought β€” let’s make a Python script do the work! 🎯

Β 

πŸš€ How It Works

The tool uses Python’s built-in modules (os, shutil, and tkinter) to:

  • Open a GUI file explorer to select your folder
  • Walk through the folder and all subfolders
  • Filter out .jpg, .jpeg, .png files
  • Copy them to extracted_images/, renaming if needed

No third-party libraries required. It's clean and fast!

Β 

πŸ“¦ Example Use Case

Let’s say you select this folder:

πŸ“‚ /project/
Β  β”œβ”€β”€ folder1/cat.jpg
Β  β”œβ”€β”€ folder2/cat.jpg
Β  β”œβ”€β”€ folder3/dog.png

After running the script, it will create:

πŸ“‚ /project/extracted_images/
Β  β”œβ”€β”€ cat.jpg
Β  β”œβ”€β”€ cat_1.jpg
Β  └── dog.png

✨ Boom! All your images are in one place.

Β 

πŸ“ Try It Yourself

You can check out the full code, README, and instructions here:
πŸ”— GitHub Repo β†’ https://github.com/codersattu/ImageExtractorFromFolder

Β 

🧠 Ideas to Extend

Feeling creative? Here are a few features you could add:

  • A progress bar to show how many files were found
  • Support for more image types like .webp, .gif, .bmp
  • Convert it into a desktop app using PyInstaller
  • Add filters by file size or resolution

Β 

πŸ‘¨β€πŸ’» Final Thoughts

This project was a fun mix of automation, GUI programming, and file system logic. It’s a great mini-project if you're learning Python or want something useful in your toolbelt.

If you find it helpful or improve it, I’d love to see your version! πŸ™Œ
Let’s make file organizing a little less painful and a lot more Pythonic.

Β 

Need help setting it up or want a .exe version? Drop a comment or reach out. Happy coding! πŸπŸ’‘

Python, Easy Hacks
3 min read
Apr 06, 2025
By Abhishek Satpathy
Share

Leave a comment

Your email address will not be published. Required fields are marked *

Related posts

Apr 06, 2025 β€’ 2 min read
CleanShot – Effortlessly Remove Duplicate Images with Python
Jan 30, 2025 β€’ 3 min read
Fake vs Real Image Detection Web App: Using AI to Spot Manipulated Images