How lpuigo/trombi works
Trombi is a command-line tool that turns image files into portrait PDFs. Its main workflow expands file or directory inputs, loads and orients each image, detects and selects a face, computes and bounds a portrait crop, then exports either a single-image diagnostic PDF or a paginated batch grid. Batch processing isolates failures per image; the service layer coordinates loading, detection, framing, and cropping. The source excerpts establish these runtime links; the tree supports the image-listing and crop modules, but their implementations were not sampled.
Main entry points: main.go Command entry · process.go Image workflow · batch.go Batch workflow · loader.go Image loading
Components 21
CLI
- Command entry
cmd/trombi/main.go
Service
- Image workflow
service/process.go - Batch workflow
service/batch.go
Portrait domain
- Batch items
domain/portrait/batch.go - Portrait item
domain/portrait/item.go - Face selection
domain/portrait/selection.go - Crop geometry
domain/portrait/framing.go - Crop bounds
domain/portrait/clamp.go - Processing results
domain/portrait/result.go - Face detector
domain/portrait/detector.go
Image and PDF adapters
- Directory listing
infra/imageio/list.go - Image loading
infra/imageio/loader.go - Decode and orient
infra/imageio/decode.go - EXIF orientation
infra/imageio/exif.go - Crop and resize
infra/imageio/crop.go - Pigo detection
infra/facedetect/pigodetect/detector.go - Diagnostic PDF
infra/pdfexport/diagnostic.go - Grid PDF
infra/pdfexport/grid.go
Other components
- CLI user
- Image files
- PDF output
Connections 26
- CLI user → Command entry: provides inputs
- Command entry → Directory listing: lists directories
- Command entry → Batch items: creates batch
- Command entry → Image workflow: processes image
- Command entry → Batch workflow: processes batch
- Command entry → Pigo detection: initializes detector
- Command entry → Diagnostic PDF: exports diagnostic
- Command entry → Grid PDF: exports grid
- Image files → Image loading: reads files
- Directory listing → Command entry: returns paths
- Batch workflow → Portrait item: processes items
- Batch workflow → Image loading: loads images
- Batch workflow → Image workflow: invokes per image
- Image workflow → Face detector: detects faces
- Pigo detection → Face detector: implements
- Image workflow → Face selection: selects face
- Image workflow → Crop geometry: computes crop
- Image workflow → Crop bounds: fits crop
- Image workflow → Crop and resize: crops and resizes
- Image workflow → Processing results: assembles result
- Image loading → Decode and orient: decodes image
- Decode and orient → EXIF orientation: reads orientation
- Batch workflow → Batch items: returns updated batch
- Command entry → PDF output: writes PDF
- Diagnostic PDF → PDF output: writes diagnostic
- Grid PDF → PDF output: writes grid