photostax-core 0.2.2

Unified photo stack library for Epson FastFoto repositories — scanning, metadata, and search
Documentation

photostax-core

Unified photo stack library for Epson FastFoto repositories — scanning, metadata, and search.

Crates.io Documentation License

Overview

Epson FastFoto scanners produce multiple files per scanned photo:

File Pattern Description
<name>.jpg or <name>.tif Original front scan
<name>_a.jpg or <name>_a.tif Enhanced version (color-corrected)
<name>_b.jpg or <name>_b.tif Back of the photo

This library groups them into a single PhotoStack abstraction, enabling applications to operate on complete photos rather than individual files.

Installation

cargo add photostax-core

Features

  • Multi-format support — JPEG (.jpg, .jpeg) and TIFF (.tif, .tiff)
  • PhotoStack abstraction — Groups front, enhanced, and back scans into a single unit
  • Repository trait — Pluggable storage backends (local filesystem included)
  • Metadata support — Read EXIF, read/write XMP, and custom sidecar database
  • Search & filter — Query stacks by metadata with a fluent builder API
  • Pagination — Fetch pages of results by offset and limit for efficient web rendering

Quick Start

use photostax_core::backends::local::LocalRepository;
use photostax_core::repository::Repository;

let repo = LocalRepository::new("/path/to/photos");
let stacks = repo.scan().unwrap();

for stack in &stacks {
    println!("Photo: {}", stack.id);
    if let Some(ref back) = stack.back {
        println!("  Has back scan: {}", back.display());
    }
}

API Overview

Core Types

Type Description
PhotoStack Represents a grouped photo with original, enhanced, and back scans
Metadata EXIF, XMP, and custom metadata for a photo stack
Repository Trait for storage backend abstraction
LocalRepository Local filesystem implementation
SearchQuery Builder for filtering stacks by metadata
PaginationParams Offset and limit for paginated queries
PaginatedResult<T> A page of results with total count and navigation metadata

Key Methods

// Scanning
let stacks = repo.scan()?;              // Discover all photo stacks
let stack = repo.get_stack("IMG_001")?; // Get specific stack by ID

// Metadata
let metadata = repo.read_metadata("IMG_001")?;
repo.write_metadata("IMG_001", &metadata)?;

// Search
let query = SearchQuery::new()
    .with_text("vacation")
    .with_has_back(true);
let results = repo.search(&query)?;

// Pagination
use photostax_core::search::{paginate_stacks, PaginationParams};
let stacks = repo.scan()?;
let page = paginate_stacks(&stacks, &PaginationParams { offset: 0, limit: 20 });
println!("Page has {} items, {} total", page.items.len(), page.total_count);
assert_eq!(page.has_more, stacks.len() > 20);

// Read image stream
use std::io::Read;
let mut bytes = Vec::new();
repo.read_image(&stack.original.unwrap().path)?.read_to_end(&mut bytes)?;

Building from Source

git clone https://github.com/JeromySt/photostax
cd photostax
cargo build --release --package photostax-core
cargo test --package photostax-core

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.


← Back to main README | API Documentation