No description
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
recipe-to-epub
Scan recipe cards via CUPS/SANE, OCR them with Tesseract, and compile into a richly styled EPUB recipe book.
Warning!!!! this is vibe coded
Workflow
Recipe card → [scanimage] → PNG → [tesseract] → raw text → [edit] → markdown → [compile] → EPUB
- Scan — capture recipe cards using any SANE-compatible scanner
- OCR — extract text with Tesseract, producing a markdown file with YAML frontmatter and raw OCR text
- Edit — manually structure the raw text into Ingredients / Instructions sections
- Compile — recipe markdown files into a styled EPUB with embedded scan images
Install
Nix (NixOS / Nix on any Linux)
nix run git+https://git.ascosilinux.com/vincent/recipe-to-epub.git -- --help
Or add to your flake inputs:
inputs.recipe-to-epub.url = "git+https://git.ascosilinux.com/vincent/recipe-to-epub.git";
From source
Requires Rust 2021+, tesseract (with eng trained data), and sane-backends (provides scanimage).
cargo install --path .
Usage
List available scanners
recipe-to-epub list-scanners
Scan a recipe card
recipe-to-epub scan --output scans/my_recipe.png
Options: --device, --resolution (default 300), --mode (Color/Gray/Lineart).
OCR a scanned image
recipe-to-epub ocr scans/my_recipe.png --output recipes/
Creates a markdown file with YAML frontmatter and raw OCR text. Open the file and organize the content under ## Ingredients and ## Instructions headings.
Batch OCR all images
recipe-to-epub process scans/ --output recipes/
Compile into EPUB
recipe-to-epub compile recipes/ --output cookbook.epub --title "Family Recipes" --author "Your Name"
Recipes are sorted alphabetically by title.
Full pipeline
recipe-to-epub all --output cookbook.epub --title "Family Recipes" --author "Your Name"
Recipe format
Each recipe is a markdown file with YAML frontmatter:
---
title: "Chocolate Chip Cookies"
source: "Family Recipe Box"
prep_time: "15 minutes"
cook_time: "10 minutes"
servings: "24 cookies"
date_scanned: "2026-06-07"
---
## Ingredients
- 2 1/4 cups all-purpose flour
- ...
## Instructions
1. Preheat oven to 375°F.
2. ...
All fields except title are optional. The image field (path to scanned PNG) is set automatically by ocr/process.
EPUB styling
The generated EPUB uses a warm, serif-based design:
- Georgia serif body text, warm brown headings
- Recipe metadata in a styled box (cream background, tan border)
- Square bullet markers for ingredients
- Embedded scan images centered with border
Project structure
src/
main.rs — CLI entry point with clap subcommands
scanner.rs — scanimage subprocess wrapper
ocr.rs — image preprocessing + Tesseract CLI
recipe.rs — Recipe struct with YAML frontmatter serialization
epub.rs — EPUB assembly with epub-builder + CSS
License
MIT