Skip to content

Digitalize and crop multiple scanned photos automatically.

License

Notifications You must be signed in to change notification settings

mrhymes26/Image-Digitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Image Digitizer

Logo

Digitize your scanned images


πŸ’‘ The Story Behind This Project

This project was born out of a practical need: digitizing multiple family photo albums.

Like many families, we had boxes full of old photo albums collecting dust – precious memories that deserved to be preserved digitally. Commercial scanning software was either too expensive, too complicated, or simply didn't do what we needed: scan multiple photos at once and automatically crop them individually.

So I built Image Digitizer – a simple, robust tool that:

  • Scans a full page with multiple photos
  • Automatically detects and crops each photo
  • Saves them individually without quality loss

What started as a weekend project to solve my own problem turned into a fully-featured application that I'm now sharing with everyone who faces the same challenge.

If you're sitting on a pile of photo albums waiting to be digitized – this tool is for you.


✨ Features

πŸ–¨οΈ Scanner Integration

  • Automatic detection of all WIA 2.0 scanners
  • Support for high resolutions (up to 1200 DPI)
  • No external manufacturer popup – everything in the app

πŸ“· Automatic Image Detection

  • Detects multiple photos on a single scan
  • Automatic cropping without quality loss
  • OpenCV-based image processing

How it works:

  1. Converts the scan to grayscale and applies noise reduction
  2. Uses threshold detection to separate photos from the white background
  3. Applies morphological operations to group connected regions
  4. Filters detected regions by size and color variance to identify actual photos
  5. Automatically crops each detected photo with a small margin

Important Notes:

  • Darker Images: Very dark photos or photos with very low contrast may not be detected correctly. The algorithm works best with photos that have clear contrast against a white or light background.
  • Fallback Behavior: If no photos are detected (e.g., very dark images or poor contrast), the entire scan will be saved as a single file instead of individual photos. This ensures you don't lose your scan even if automatic detection fails.
  • Logging: All detection results (successful detections, failed detections, number of photos found) are logged to %LOCALAPPDATA%\ImageDigitizer\log.txt for troubleshooting.

πŸ’Ύ Flexible Storage Options

  • PNG (lossless) or JPEG export
  • Automatic saving after scan
  • Custom storage location (remembered between sessions)

🌍 Multilingual

  • German / English
  • Modern toggle switch for switching

πŸ”§ Robust Scanner Communication

  • Dynamic timeout based on DPI (high-res scans get more time)
  • Automatic retry on busy scanner
  • Improved connection cleanup

πŸ“Έ Screenshot

Image Digitizer Screenshot

The app offers a modern, intuitive user interface in Windows 11 style.


πŸš€ Installation

Requirements

  • Windows 10/11
  • WIA 2.0 compatible scanner
  • No additional software required - .NET Runtime is included

Download

  1. Download ImageDigitizer-v1.0-win-x64-selfcontained.zip from Releases
  2. Extract the ZIP archive
  3. Run ImageDigitizer.exe
  4. Done! No additional installation needed.

Note: The self-contained version includes the .NET Runtime (~150 MB), so no separate installation is required. It works on any Windows 10/11 PC.


πŸ”¨ Building from Source

If you want to build the application yourself, you have two options:

Prerequisites

  • .NET 8.0 SDK
  • Visual Studio 2022, Rider, or any IDE with .NET support
  • Git (for cloning the repository)

Option 1: Self-Contained Build (Recommended)

This creates a standalone executable with all dependencies included:

# Clone the repository
git clone https://github.com/mrhymes26/image-digitizer.git
cd image-digitizer

# Build self-contained version
dotnet publish -c Release -r win-x64 --self-contained true -p:SelfContained=true -o "release-build-selfcontained"

The output will be in release-build-selfcontained/ directory. This version includes the .NET Runtime and all dependencies (~150 MB).

Option 2: Standard Build (Requires .NET Runtime)

This creates a smaller build that requires .NET 8.0 Runtime to be installed:

# Clone the repository
git clone https://github.com/mrhymes26/image-digitizer.git
cd image-digitizer

# Build standard version
dotnet publish -c Release -r win-x64 -o "release-build"

The output will be in release-build/ directory. Users will need to have .NET 8.0 Runtime installed (~10 MB).

Development Build

For development and testing:

# Clone the repository
git clone https://github.com/mrhymes26/image-digitizer.git
cd image-digitizer

# Restore dependencies
dotnet restore

# Build
dotnet build

# Run
dotnet run

Build from Source

git clone https://github.com/mrhymes26/image-digitizer.git
cd image-digitizer
dotnet build
dotnet run

πŸ› οΈ Technology Stack

  • Framework: WPF (.NET 8)
  • Scanner API: WIA 2.0 (Windows Image Acquisition)
  • Image Processing: OpenCVSharp 4.8
  • Language: C# 12

πŸ“ Project Structure

ImageDigitizer/
β”œβ”€β”€ App.xaml                 # Application Resources & Styles
β”œβ”€β”€ MainWindow.xaml          # Main UI
β”œβ”€β”€ MainWindow.xaml.cs       # UI Logic
β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ ScannerDevice.cs     # Scanner Data Model
β”‚   └── ScanSettings.cs      # Scan Settings
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ ScannerService.cs    # Scanner Abstraction (STA-Thread handling)
β”‚   β”œβ”€β”€ WiaInterop.cs        # WIA COM Interop
β”‚   └── ImageProcessor.cs    # Image Processing & Detection
└── Utils/
    β”œβ”€β”€ AppSettings.cs       # Persistent Settings
    β”œβ”€β”€ Localization.cs      # DE/EN Translations
    └── Logger.cs            # Debug Logging

βš™οΈ Configuration

File Locations

Settings:

%LOCALAPPDATA%\ImageDigitizer\settings.json

Contains: output folder, language, last scanner, DPI, format preferences

Logs:

%LOCALAPPDATA%\ImageDigitizer\log.txt

Contains: debug information, scan operations, error messages

Output Folder (Scanned Images):

  • Default: %USERPROFILE%\Pictures\ImageDigitizer
  • Can be changed in the app settings
  • Each scan creates individual photo files (PNG or JPEG)

πŸ”„ How It Works

Workflow

  1. Scan: Place multiple photos on the scanner and click "Scan"
  2. Detection: OpenCV algorithms automatically detect individual photos
  3. Processing: Each detected photo is cropped with a small margin
  4. Saving: Photos are saved individually as separate files (PNG or JPEG)
  5. Ready: All photos are saved to your output folder

Fallback: If no photos are detected (e.g., very dark images), the entire scan is saved as a single file to ensure you don't lose your work.

Photo Detection Algorithm

The app uses computer vision algorithms to identify photo boundaries:

  1. Grayscale Conversion: Converts the scan to grayscale for processing
  2. Noise Reduction: Applies filters to reduce scanner noise
  3. Threshold Detection: Separates photos from the white/light background
  4. Morphological Operations: Groups connected regions together
  5. Size & Color Filtering: Identifies actual photos by size and color variance
  6. Auto-Cropping: Crops each detected photo with a small margin

Best Results:

  • Photos with clear contrast against white/light background
  • Some spacing between photos
  • Good lighting on the scanner
  • Clean scanner glass

Limitations:

  • Very dark images may not be detected correctly
  • Low contrast photos (e.g., dark photos on dark background) may fail detection
  • If detection fails: The entire scan is saved as a single file, so you don't lose your work
  • Logging: Detection results are logged to %LOCALAPPDATA%\ImageDigitizer\log.txt - check this file if photos aren't detected as expected

πŸ”§ Scanner Notes

High DPI (600/1200)

  • WSD scanners are often limited to 300 DPI
  • High-res scans may take several minutes – the app now has dynamic timeouts

Supported Scanners

  • All WIA 2.0 compatible scanners
  • Tested with Brother MFC-L8690CDW

πŸ“ Changelog

See CHANGELOG.md for full version history.

v1.0.0 (Initial Release)

  • WIA 2.0 scanner support with automatic detection
  • Automatic photo detection and cropping using OpenCV
  • Lossless saving (PNG) or high-quality JPEG (95%)
  • Dynamic scan timeout based on DPI
  • Robust STA-Thread handling with retry logic
  • Windows 11 modern UI design
  • German/English localization

🀝 Contributing

Contributions are welcome! Please create a Pull Request or open an Issue.

See CONTRIBUTING.md for details.


πŸ“¦ Dependencies

This project uses the following third-party libraries:

  • OpenCvSharp4 (v4.8.0.20230708) - Apache License 2.0

  • System.Drawing.Common (v8.0.0) - MIT License

    • Microsoft .NET library for image handling
  • WIA 2.0 - Windows API

    • Built-in Windows Image Acquisition API (no additional license)

For full license information, see NOTICE file.


πŸ“„ License

MIT License - see LICENSE


πŸ‘¨β€πŸ’» Developer

Developed by mrhymes26

β˜• Support the Project

If you find this project useful, consider supporting its development:

Buy Me A Coffee

Support on Buy Me a Coffee


πŸ”’ Security

Note: This application runs entirely locally on your computer:

  • No network connections (except for scanner communication)
  • No data is sent to external servers
  • All processing happens on your machine
  • Scanned images are saved only to your local storage

As such, security concerns are minimal. The application only accesses:

  • Your scanner (via WIA 2.0)
  • Local file system (for saving images)
  • Windows system APIs

Image Digitizer – Digitize your memories, one album at a time.