This directory contains comprehensive examples demonstrating the various features and capabilities of auto-image-diff.
Demonstrates fundamental image comparison functionality.
npm run example:basic- Simple before/after comparison
- Basic diff generation
- Statistics reporting
Shows the intelligent classification system for categorizing changes.
npm run example:classification- Automatic change type detection
- Confidence scoring
- Detailed classification reports
Demonstrates batch processing with parallel execution.
npm run example:batch- Process multiple images concurrently
- Smart file pairing
- Comprehensive batch reports
- HTML summary generation
Interactive refinement process for improving accuracy.
npm run example:refine- Iterative exclusion suggestions
- Interactive acceptance/rejection
- Session persistence
- Accuracy improvement tracking
Automatic CSS fix generation for style changes.
npm run example:css-fixes- Style change detection
- CSS property suggestions
- Confidence-based prioritization
- HTML preview generation
Enhanced metadata collection and embedding.
npm run example:metadata- Git information capture
- Environment details
- PNG metadata embedding/extraction
- Execution tracking
- Install dependencies:
npm install- Create example directories:
mkdir -p examples/screenshots/baseline
mkdir -p examples/screenshots/current
mkdir -p examples/output- Add sample images to the screenshots directories
# Basic comparison
npx ts-node examples/basic-comparison.ts
# With classification
npx ts-node examples/smart-classification.ts
# Batch processing
npx ts-node examples/batch-processing.ts
# Progressive refinement (interactive)
npx ts-node examples/progressive-refinement.ts
# CSS suggestions
npx ts-node examples/css-fix-suggestions.ts
# Metadata tracking
npx ts-node examples/metadata-tracking.tsnpm run examples:allexamples/
├── README.md # This file
├── basic-comparison.ts # Basic usage
├── smart-classification.ts # Classification demo
├── batch-processing.ts # Batch operations
├── progressive-refinement.ts # Refinement workflow
├── css-fix-suggestions.ts # CSS fix generation
├── metadata-tracking.ts # Metadata features
├── screenshots/ # Input images
│ ├── baseline/ # Reference images
│ └── current/ # Comparison images
└── output/ # Generated results
├── batch-results/ # Batch processing output
├── refinement/ # Refinement session data
├── css-fixes/ # CSS suggestions
└── metadata-example/ # Metadata reports
- Sample Images: Use real screenshots from your application for best results
- Exclusions: Define exclusion regions for dynamic content (timestamps, user data)
- Thresholds: Adjust difference thresholds based on your tolerance
- Parallel Processing: Enable for large batches to improve performance
- Classification: Use classification to understand the nature of changes
- Refinement: Use progressive refinement to eliminate false positives
Each example can be customized by modifying:
- Input/output paths
- Processing options
- Threshold values
- Classification settings
- Report formats
Examples generate various output files:
- PNG diffs: Visual difference images
- JSON reports: Detailed comparison data
- HTML summaries: Interactive reports
- CSS files: Suggested style fixes
- Session data: Refinement progress
If examples fail:
- Ensure ImageMagick is installed:
convert -version - Check that input images exist in the screenshots directory
- Verify output directories are writable
- Check console output for specific error messages