Automatically delete grayscale or mostly black-and-white images from a folder.
Scans a folder recursively and deletes images that exceed a grayscale threshold (0-100%). Uses fast file signatures and SQLite caching to avoid re-processing unchanged files.
Supported formats: JPG, JPEG, PNG, BMP, WebP, GIF, TIF, TIFF
pip install Pillow numpyEdit the configuration at the bottom of NoirDeleter.py:
process_folder(
folder_path=r"F:\Porn\ToSort", # Directory to scan (includes subdirectories)
threshold=99, # Grayscale % to delete (0-100). Recommended: 99
workers=12 # Parallel threads (max 12 on HDD)
)Then run:
python NoirDeleter.py- Calculates a grayscale score (0-100) for each image by comparing RGB channel differences
- Deletes images meeting or exceeding the threshold
- Caches results in
NoirDeleter.cache.sqlite3to skip unchanged files on subsequent runs - Processes images in parallel using worker threads
- Cached files are skipped entirely (fastest)
- Speed: 30-150 images/sec depending on image size, about 500/s for cached files (guesstimated on:5600X, sata SSDs, 3600MTs ram)
- Periodic saves prevent excessive memory usage on large folders
- The script permanently deletes matched files—use with caution
- Threshold of 99 is recommended to catch only nearly-grayscale images
- Results are cached; delete
NoirDeleter.cache.sqlite3to re-evaluate all images