#epub #optimization #ebook #image #compression

bin+lib optiepub

A tool for optimizing EPUB files by compressing images and removing unnecessary content

1 unstable release

0.0.1 Dec 8, 2024

#28 in #ebook

AGPL-3.0

32KB
789 lines

OptiEPUB

OptiEPUB is a command-line tool for optimizing EPUB files by LunNova.

Installation

Install OptiEPUB using cargo:

cargo install optiepub

Features

  • Image optimization with content-aware cropping
  • Duplicate and unused asset detection and removal
  • Automatic format conversion for efficiency (e.g., PNG to JPEG if transparency isn't needed)
  • HTML reference updating and EPUB structure preservation
  • Customizable optimization parameters

Usage

optiepub [OPTIONS] <input>

Example:

# Create output.epub from input.epub
# Use quality level 80 for JPEGs
# Resize images over 1200 pixels
optiepub -q 80 -d 1200 input.epub -o output.epub

Run optiepub --help for full option list.

Dependencies

~41MB
~660K SLoC