remove-similar-image
Skill11 starsChanged 3 months agoMITView on GitHub
Analyze local image files with ImageHash and OpenCV to detect near-duplicate photos and blurry shots, then preview or remove them. Use when Codex needs to clean a photo folder, deduplicate similar images, identify blur, or safely delete/move bad images after reviewing a report.
- Installs packages
In this repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- academic-paper-downloadSkill
- airnow-hourly-obs-fetchSkill
- ai-tech-fulltext-fetchSkill
- ai-tech-rss-fetchSkill
- ai-tech-summarySkill
- apply-environmental-thinkingSkill
- bluesky-cascade-fetchSkill
- convert-image-to-jpgSkill
- dify-knowledge-base-searchSkill
- dify-knowledge-base-uploadSkill
- document-granular-decomposeSkill
- domain-onboardingSkill
- eceee-news-fulltext-fetchSkill
- email-imap-appendSkill
- email-imap-fetchSkill
- email-imap-full-fetchSkill
- email-smtp-sendSkill
- epa-eis-records-fetchSkill
- federal-register-doc-fetchSkill
- fetch-abstract-to-kbSkill
- fetch-meta-from-kbSkill
- fetch-meta-to-kbSkill
- figshare-data-downloadSkill
- gdelt-doc-searchSkill
- gdelt-events-fetchSkill
- gdelt-gkg-fetchSkill
- gdelt-mentions-fetchSkill
- gdelt-web-ngrams-searchSkill
- github-contribution-period-analysisSkill
- nasa-firms-fire-fetchSkill
- notebooklmSkill
- openaq-data-fetchSkill
- open-meteo-air-quality-fetchSkill
- open-meteo-flood-fetchSkill
- open-meteo-historical-fetchSkill
- regulationsgov-attachments-fetchSkill
- regulationsgov-comment-detail-fetchSkill
- regulationsgov-comments-fetchSkill
- river-outfall-status-visualizerSkill
- sustainability-fulltext-fetchSkill
- sustainability-rss-fetchSkill
- sustainability-summarySkill
- synology-file-stationSkill
- tiangong-auto-researchSkill
- tiangong-auto-research-workbuddySkill
- tiangong-kb-course-fulltext-fetchSkill
- tiangong-kb-course-searchSkill
- tiangong-kb-edu-searchSkill
- tiangong-kb-esg-searchSkill
- tiangong-kb-ingestSkill
- tiangong-kb-patent-searchSkill
- tiangong-kb-report-searchSkill
- tiangong-kb-sci-searchSkill
- tiangong-kb-textbook-searchSkill
- tsinghua-graduate-thesisSkill
- usbr-project-records-fetchSkill
- usbr-rise-fetchSkill
- use-thuenv-presentation-styleSkill
- usgs-water-iv-fetchSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use ImageHash to cluster exact duplicates and near-duplicates.
- Distinctive: line 11
Use OpenCV variance-of-Laplacian blur scoring to flag blurry shots.
- Very specific: line 16
Start with doctor if dependency availability is unknown.
- Very specific: line 17
Treat analyze without --apply as the safe default.
- Very specific: line 18
Prefer --trash-dir before permanent deletion so the user can review results.
- Very specific: line 27
If doctor reports missing dependencies, stop and surface the install command instead of pretending the scan ran.
- Very specific: line 91
Default similarity detection uses phash with hash_size=8 and similar-threshold=5.
- Very specific: line 92
Default blur detection uses a variance-of-Laplacian cutoff of 100.0.
- Very specific: line 93
Default keep-policy=best prefers non-blurry images, then sharper images, then larger images.
- Very specific: line 98
Use --trash-dir for the first pass on any valuable photo collection.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Remove Similar Image
Core Goal
- Scan one local image or a directory tree of local images.
- Use ImageHash to cluster exact duplicates and near-duplicates.
- Use OpenCV variance-of-Laplacian blur scoring to flag blurry shots.
- Preview actions first, then permanently delete or move candidates to a trash folder when requested.
Required Script
- Use
scripts/remove_similar_images.py. - Start with
doctorif dependency availability is unknown. - Treat
analyzewithout--applyas the safe default. - Prefer
--trash-dirbefore permanent deletion so the user can review results.
Dependency
- This skill requires Pillow, ImageHash, numpy, and OpenCV:
python3 -m pip install Pillow ImageHash numpy opencv-python-headless- If
doctorreports missing dependencies, stop and surface the install command instead of pretending the scan ran.
Workflow
- Check dependencies:
python3 scripts/remove_similar_images.py doctor- Preview similar groups and blurry images for a folder:
python3 scripts/remove_similar_images.py analyze \
--input-path /path/to/photos- Preview safe cleanup by moving similar non-keepers and blurry files into a trash folder:
python3 scripts/remove_similar_images.py analyze \
--input-path /path/to/photos \
--delete-similar \
--delete-blurry \
--trash-dir /path/to/review-trash- Apply the move after the preview looks correct:
python3 scripts/remove_similar_images.py analyze \
--input-path /path/to/photos \
--delete-similar \
--delete-blurry \
--trash-dir /path/to/review-trash \
--apply- Permanently delete only similar non-keepers:
python3 scripts/remove_similar_images.py analyze \
--input-path /path/to/photos \
--delete-similar \
--applyMain Arguments
--input-path: source image file or directory.--no-recursive: scan only the top-level directory.--extra-extension: include additional suffixes not covered by default.--limit: cap the number of scanned files for quick tests.--hash-method:phash,dhash,ahash, orwhash.--hash-size: larger hashes are stricter and slower.--similar-threshold: maximum Hamming distance considered similar.--blur-threshold: Laplacian-variance cutoff for blurry images.--keep-policy: choose the keeper in each similar group withbest,largest,newest, oroldest.--delete-similar: mark non-keeper files in similar groups as removal candidates.--delete-blurry: mark blurry files as removal candidates even when they are unique.--trash-dir: move files into a review directory instead of permanently deleting.--apply: execute removals or moves. Without this flag the script only reports.--report-json: save a machine-readable report for later review.--print-json: print the full report as JSON to stdout.
Default Heuristics
- Default similarity detection uses
phashwithhash_size=8andsimilar-threshold=5. - Default blur detection uses a variance-of-Laplacian cutoff of
100.0. - Default
keep-policy=bestprefers non-blurry images, then sharper images, then larger images. - Similar groups are connected components: if
Ais close toB, andBis close toC, they are treated as one group even ifAandCare slightly farther apart.
Usage Notes
- Review the preview before adding
--apply. - Use
--trash-dirfor the first pass on any valuable photo collection. - Lower
--similar-thresholdto be stricter. Raise it when near-duplicates are being missed. - Lower
--blur-thresholdif too many acceptable images are marked blurry. Raise it when obvious blur is missed. - Expect format support to follow Pillow and OpenCV availability in the local environment.
Output
- Text mode prints scan counts, similar groups, blurry images, and planned or applied actions.
- JSON mode includes per-image metadata, unreadable files, similar groups, planned actions, and action results.
Script
scripts/remove_similar_images.py
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

