Skip to content

yshalsager/calibre-with-kfx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

164 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calibre with KFX Docker

GitHub CI Docker Hub badge ghcr.io badge ghcr.io size badge

GitHub license GitHub release

PayPal Patreon Liberapay

A Docker image for converting eBooks using Calibre with KFX support.

KFX is Amazon's proprietary eBook format used for Kindle devices.

Why?

Because Amazon's Kindle Previewer 3 is the only way currently to convert books into KFX using Calibre KFX Input and KFX Output plugins, and it's not available on Linux, so I run it under docker using Wine.

Usage

To use the Docker image, you can build it locally using the Dockerfile provided in this repository, or you can pull the image from Docker Hub using the following command:

docker pull yshalsager/calibre-with-kfx

Once you have the Docker image, you can run it using the following command:

docker run --rm -it -v "/path/to/local/folder:/app:rw" yshalsager/calibre-with-kfx [input_file] [output_file] [extra args]

Examples:

  • Convert to azw3 with extra arguments: docker run --rm -it -v "$(pwd):/app:rw" yshalsager/calibre-with-kfx epub30-spec.epub epub30-spec.azw3 --dont-compress
  • Convert to KFX: docker run --rm -it -v "$(pwd):/app:rw" yshalsager/calibre-with-kfx epub30-spec.epub epub30-spec.kfx
  • Convert to KFX with approximate page numbers (auto): docker run --rm -it -v "$(pwd):/app:rw" yshalsager/calibre-with-kfx book.epub book.kfx --pages 0

When converting to KFX, extra args are passed to the KFX Output plugin (calibre-debug -r "KFX Output" -- ...). Useful flags include:

  • --pages N create approximate page numbers if missing (0 = auto)
  • --book mark as EBOK (vs default PDOC)
  • --asin BXXXXXXXXX set an ASIN
  • --logs include Kindle Previewer conversion logs
  • --quality include Kindle Previewer quality report
  • --timeout stop conversions lasting over ~15 minutes

When converting from KFX to other formats, this image uses ebook-convert normally. Any ebook-convert CLI options can be passed as extra args.

The KFX Input plugin also provides a separate CLI (useful for print replica PDF extraction, CBZ creation, resource unpacking, etc):

docker run --rm -it -v "$(pwd):/app:rw" --entrypoint calibre-debug yshalsager/calibre-with-kfx \
  -r "KFX Input" -- /app/book.kfx --help

Common KFX Input CLI flags:

  • --epub (default), --epub2
  • --pdf extract/produce PDF (print replica, comics/children's)
  • --cbz create CBZ (print replica, comics/children's)
  • --unpack extract resources to a ZIP
  • --json-content create JSON content/position file
  • --cover force a generic EPUB cover if missing

KFX Input has one calibre "Convert Books" option: allow_conversion_with_errors (default off). It also has plugin preferences used by its CLI/From-KFX UI (for example splitting landscape comic images when creating PDF).

Versioning

The docker image versions are tagged with build date and time. There's a GitHub release for each tag that lists versions of each component of the image, like base OS, Calibre and its plugins, and Kindle Previewer.

Whenever any component gets updated, a new image is built and pushed.

About

A Docker image for running Calibre with KFX support to allow conversion of KFX files to other formats.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors