Skip to content

jgalat/kindlecc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kindlecc

Crate Status

A small, fast CBZ-to-MOBI converter for Kindle, written in Rust.

Inspired by and largely modelled after kcc (Kindle Comic Converter). kindlecc is a stripped-down CLI for the same job — extract images from a CBZ, process them (margin crop, auto-contrast, grayscale, resize, optional double-page split), build a fixed-layout EPUB, and run kindlegen to produce a MOBI with proper cover metadata for the sleep / home-screen thumbnail.

Requirements

  • Rust (stable, edition 2024) — install via rustup.
  • kindlegen on your PATH.

Installing kindlegen

Amazon discontinued kindlegen and no longer distributes it. You'll need to fetch the last released tarball from a third-party mirror.

Arch / AUR users: the kindlegen package handles it for you.

Gentoo (and any other distro without a package): grab the tarball that the AUR PKGBUILD points to, extract it, and drop the binary somewhere on your PATH. For example:

# Pull the source URL from the AUR PKGBUILD, then:
mkdir -p ~/.local/opt/kindlegen
tar -xzf kindlegen_linux_2.6_i386_v2_9.tar.gz -C ~/.local/opt/kindlegen
ln -s ~/.local/opt/kindlegen/kindlegen ~/.local/bin/kindlegen   # if ~/.local/bin is on PATH
# or
sudo install -m 0755 ~/.local/opt/kindlegen/kindlegen /usr/local/bin/kindlegen

Verify:

kindlegen 2>&1 | head -1
# Amazon kindlegen(Linux) V2.9 build 1028-0897292 ...

Installing kindlecc

From crates.io:

cargo install kindlecc

Or build from source (in this repo):

cargo install --path .

Either way, the kindlecc binary lands in ~/.cargo/bin/ (make sure it's on your PATH). Re-run with --force to upgrade.

Usage

kindlecc INPUT [INPUT...] [OPTIONS]

INPUT is one or more .cbz files, or directories containing .cbz files.

Examples

Convert a single volume:

kindlecc ~/manga/HunterXHunter-v01.cbz

Convert a whole directory into a separate output folder:

kindlecc ~/manga/HunterXHunter -o ~/manga-mobi

Left-to-right reading (default is right-to-left for manga):

kindlecc -l ~/manga/HunterXHunter-v01.cbz

Run more conversions in parallel (default is half your CPU threads):

kindlecc -j 8 ~/manga/HunterXHunter

Options

Flag Description
-o, --output <DIR> Output directory (default: same dir as input)
-r, --right-to-left Right-to-left reading (default; for manga)
-l, --left-to-right Left-to-right reading (for western comics)
-q, --quality <N> JPEG quality, 1–100 (default: 100)
--no-crop Disable margin cropping
--no-contrast Disable auto-contrast
--no-split Disable double-page spread splitting
-j, --jobs <N> Parallel files (default: half of CPU threads)
--quiet Print only output file paths

What kindlecc does to each page

  1. Extract images from the CBZ in natural sort order.
  2. If a page is wider than tall, split it into two pages (LTR/RTL aware).
  3. Crop near-uniform white/black margins (up to 10% per edge).
  4. Convert to grayscale and apply an auto-contrast stretch.
  5. Resize to fit 1072×1448 (Kindle Paperwhite-class panel) preserving aspect.
  6. JPEG-encode at the chosen quality.
  7. Build a fixed-layout EPUB 3 with the first page tagged as the cover image.
  8. Run kindlegen to produce the final .mobi.

Acknowledgements

All of the design choices around panel size, fixed layout, page-spread spine ordering, etc. come from kcc. Use kcc if you want a full-featured GUI, more output formats, and active community support — kindlecc is a minimal Rust reimplementation tuned for fast, parallel batch CBZ→MOBI conversion from the command line.

About

Fast Rust CLI that turns CBZ manga and comics into Kindle-ready MOBI files. Inspired by KCC.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages