Sorting photos by resolution is a useful tool for organizing large image collections. Below is a comprehensive guide to building a photo sorter that reads images from a folder, sorts them by their resolution (width × height), and outputs the sorted list or moves/copies the files accordingly.
Photo Sorter by Resolution (Python)
Explanation:
-
PIL (Pillow): Used for opening images and getting their dimensions.
-
Supported formats: JPG, PNG, BMP, GIF, TIFF.
-
Sorting logic: Images are sorted by total pixel count (width × height), descending order.
-
Output: Prints file name and resolution details.
Optional Enhancements:
-
Move files into subfolders by resolution category, e.g.,
High,Medium,Low. -
Copy files instead of just listing.
-
GUI interface with Tkinter for user-friendliness.
-
Export results to CSV or JSON.
If you want, I can help build any of these extensions!