Expand description
Optimize EPUBs for e-ink readers.
The engine works on any reader/writer pair, so it does not care whether the
book comes from a file, memory or (later) a browser. Front ends such as the
prensa CLI handle paths, atomic writes and printing.
use std::fs::File;
let input = File::open("book.epub")?;
let output = File::create("book-optimized.epub")?;
let report = prensa::optimize(input, output, &prensa::Options::default())?;
println!("{} image(s) optimized", report.images_changed);§Features
parallel(off by default): optimize images on all cores with rayon. The output is identical either way. Off by default so the library adds no threads where they are unavailable, such as WebAssembly in the browser.
Structs§
- Options
- Optimization settings, always valid.
- Options
Builder - Builds an
Options. Settings not given keep their default. - Progress
- Where
optimize_with_progressis in the book. - Report
- What
optimizedid to the book. - Warning
- A problem that did not stop the book.
Displaygivesentry: message.
Enums§
- Device
- An e-reader prensa has a profile for.
- Error
- Why
optimizefailed. - Invalid
Options - Why
OptionsBuilder::buildrefused the settings. - Rotation
- Which way wide images are turned to fill a portrait screen.
Functions§
- optimize
- Read an EPUB from
inputand write an optimized copy tooutput. - optimize_
with_ progress - Like
optimize, callingon_progressbefore each entry is processed.