Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xcoder-es/media-cleaner-pro/llms.txt

Use this file to discover all available pages before exploring further.

When MediaCleaner Pro finishes processing, every image file that was acted on by the pipeline is moved into a structured subdirectory tree rooted at DEST_DIR. The layout mirrors the pipeline’s four broad concerns — deduplication, rejection, content categorization, and quality ranking — making it straightforward to review, archive, or delete each group independently. Images that pass all stages without matching any category stay exactly where they are in the source directory.

Output Directory Tree

output/
├── duplicates/
│   ├── exact/          # SHA-256 identical files
│   └── perceptual/     # Visually similar files (dHash)
├── rejected/
│   └── tiny/           # Below MIN_WIDTH × MIN_HEIGHT
├── categories/
│   ├── icons/          # Square images ≤ 256px
│   ├── thumbnails/     # Small images or thumb-named files
│   ├── screenshots/    # Common screen resolutions or named
│   ├── wallpapers/     # Ultrawide or 4K+ landscape images
│   └── documents/      # Paper-ratio high-res images
└── quality/
    ├── excellent/      # Score ≥ 90
    ├── good/           # Score 75–89
    ├── average/        # Score 50–74
    ├── below_average/  # Score 25–49
    └── poor/           # Score < 25
Subdirectories are created on demand — if no wallpapers are detected in a run, categories/wallpapers/ is never created. Directories added in one run are not cleaned up between runs.

Routing Priority

MediaCleaner Pro routes each image to exactly one destination. All 10 stages run for every image, and after they complete the routing logic scans the results in order from 1 to 10, selecting the first stage whose condition was met.

Rejection Stages (1–8)

Stages 1–8 can reject an image. All 10 stages still run for every image; after they complete, the routing logic picks the first stage whose condition was satisfied and moves the file to that stage’s subdirectory.

Classification & Ranking (9–10)

Stages 9 and 10 never reject. Stage 9 (AI Classification) is used as the routing fallback when no rejection stage fired. Stage 10 (Quality Ranking) always records a score; its quality/ directory is used only when neither a rejection stage nor Stage 9 has claimed the file.
The routing logic in run_streaming_pipeline implements this directly:
let destination = stage_results
    .iter()
    .find(|r| !r.passed && r.destination.is_some())   // first rejection stage
    .and_then(|r| r.destination.clone())
    .or_else(|| {
        stage_results                                   // fallback: AI classification
            .iter()
            .find(|r| r.stage_name == "AI Classification")
            .and_then(|r| r.destination.clone())
    });
A concrete example of how a file travels through the pipeline:
StageCondition met?Action
1 – Exact DuplicateNoContinues
2 – Perceptual DuplicateNoContinues
3 – Tiny ImageNoContinues
4 – Icon DetectionYes (120×120, square)categories/icons/ — routing stops

Files That Stay in the Source Directory

Unique images that pass all rejection stages (1–8) and receive no AI classification (Stage 9 is disabled or yields no match) are left in place. MediaCleaner Pro does not move files to a “keep” folder — the absence of a move is the signal that an image was considered unique and unclassified. This avoids needlessly copying high-value originals and makes it safe to run the pipeline on a live library.

Configuring the Output Root with DEST_DIR

All output subdirectories are rooted under the path set in the DEST_DIR environment variable. Edit .env in the same directory as the binary to change it:
# .env
DEST_DIR=./data/output
VariableDefaultDescription
DEST_DIR./data/outputRoot directory for all organized output subdirectories
DEST_DIR can be an absolute path or a path relative to the binary’s working directory. The directory is created automatically on first run if it does not exist. You can point DEST_DIR at a separate drive or network share — just be aware of the note below regarding atomic moves.
File moves are performed as a rename operation, which is atomic when the source and destination are on the same filesystem. If SOURCE_DIR and DEST_DIR are on different drives or volumes, the runtime falls back to a copy-then-delete sequence, which is not atomic. To preserve atomicity and maximize throughput, keep both directories on the same physical or logical volume.

Reviewing Results After a Run

After processing completes, the output tree gives you a clear picture of what was found:
  • duplicates/ — safe to delete after spot-checking; both exact and perceptual duplicates are grouped for easy review.
  • rejected/tiny/ — contains images below your configured minimum dimensions. Review before deleting if you use MIN_WIDTH/MIN_HEIGHT values higher than the defaults.
  • categories/ — contains images that were not duplicates or rejects but were identified as a specific type (icon, thumbnail, screenshot, wallpaper, document, or AI-classified content).
  • quality/ — populated only when an image passes all rejection stages (1–8) and Stage 9 assigns no category. In practice, Stage 9 classifies every image, so these directories appear only in edge cases where classify_image returns no matching categories.
After a run, browse the categories/ tree to review the AI Classification results. The categories/portrait/, categories/landscape/, and categories/social/ subdirectories in particular give a quick visual overview of the images that made it through all rejection stages — a useful starting point for deciding which files to keep, export, or delete.

Build docs developers (and LLMs) love