/kcc

KCC (a.k.a. Kindle Comic Converter) is a comic and manga converter for ebook readers.

Primary LanguagePythonISC LicenseISC

KCC

GitHub release PyPI GitHub Workflow Status

GitHub release PyPI AUR

Kindle Comic Converter is a Python app to convert comic/manga files or folders to EPUB, Panel View MOBI or E-Ink optimized CBZ. It was initially developed for Kindle but since version 4.6 it outputs valid EPUB 3.0 so despite its name, KCC is actually a comic/manga to EPUB converter that every e-reader owner can happily use. It can also optionally optimize images by applying a number of transformations.

A word of warning

KCC is not Amazon's Kindle Comic Creator nor is in any way endorsed by Amazon. Amazon's tool is for comic publishers and involves a lot of manual effort, while KCC is for comic/manga readers. KC2 in no way is a replacement for KCC so you can be quite confident we are going to carry on developing our little monster ;-)

Issues / new features / donations

If you have general questions about usage, feedback etc. please post it here. If you have some technical problems using KCC please file an issue here. If you can fix an open issue, fork & make a pull request.

If you find KCC valuable you can consider donating to the authors:

  • Ciro Mattia Gonano:
    • Donate PayPal
    • Donate Flattr
  • Paweł Jastrzębski:
    • Donate PayPal
    • Donate Bitcoin

INSTALLATION

BINARY RELEASES

You can find the latest released binary at the following link:

https://github.com/darodi/kcc/releases

Linux installation

  • make binary executable
    $ chmod a+x kcc_linux
  • install 7zip
    $ sudo apt-get install -y p7zip-full
  • Download kindlegen
    $ wget -qO- https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz | tar xvz kindlegen
  • copy kindlegen into '/usr/local/bin' and grant execute permissions for MOBI conversion.
    $ sudo cp -R kindlegen /usr/local/bin && sudo chmod a+x /usr/local/bin/kindlegen 
  • run with backend x11 or it might not work with fedora
    $ GDK_BACKEND=x11 ./kcc_linux

Old stable

You can find the old released binary at the following links:

  • Windows (64-bit only)
  • macOS (10.14+)
  • Linux: Currently unavailable.

PYPI

KCC is also available on PyPI.
On Debian based distributions these two commands should install all needed dependencies:

$ sudo apt-get install python3 python3-dev python3-pip libpng-dev libjpeg-dev p7zip-full python3-pyqt5
$ pip3 install --user --upgrade pillow python-slugify psutil pyqt5 raven

beta version

$ pip install --index-url https://test.pypi.org/simple/  KindleComicConverterDarodi

final version

$ pip install --user KindleComicConverter

APPIMAGE

  • install 7zip
    $ sudo apt-get install -y p7zip-full
  • Download kindlegen
    $ wget -qO- https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz | tar xvz kindlegen
  • copy kindlegen into '/usr/local/bin' and grant execute permissions for MOBI conversion.
    $ sudo cp -R kindlegen /usr/local/bin && sudo chmod a+x /usr/local/bin/kindlegen 
  • make appImage executable
    $ chmod a+x kindleComicConverter-latest-x86_64.AppImage
  • run with backend x11 or it might not work with fedora
    $ GDK_BACKEND=x11 ./kindleComicConverter-latest-x86_64.AppImage

DOCKER

install kindlegen in your working directory and get last docker image

$ wget -qO- https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz | tar xvz kindlegen
$ docker pull ghcr.io/darodi/kcc:latest

execute kcc-c2e

$ docker run --rm -v "$(pwd):/app" ghcr.io/darodi/kcc:latest 

execute kcc-c2p

$ docker run --entrypoint /opt/kcc/kcc-c2p.py --rm -v "$(pwd):/app" ghcr.io/darodi/kcc:latest 

DEPENDENCIES

Following software is required to run Linux version of KCC and/or bare sources:

On Debian based distributions these two commands should install all needed dependencies:

$ sudo apt-get install python3 python3-dev python3-pip libpng-dev libjpeg-dev p7zip-full python3-pyqt5

$ pip3 install --user --upgrade pillow python-slugify psutil pyqt5 raven

Optional dependencies

  • KindleGen deprecated link v2.9+ in a directory reachable by your PATH or in KCC directory *(For MOBI generation) – which offers a command line interface and supports Linux (mirror1), Mac OSX and Windows – has been deprecated, but binaries can still be found on the internet.
  • 7z (For CBZ/ZIP, CBR/RAR, 7z/CB7 support)

INSTALL FROM SOURCES

Originally posted by @hhtien1408 in ciromattia#438 (comment)

$ git clone -branch beta_release https://github.com/darodi/kcc.git

On Debian based distributions these two commands should install all needed dependencies:

$ sudo apt-get install python3 python3-dev python3-pip libpng-dev libjpeg-dev p7zip-full python3-pyqt5

Then install the necessary packages. You can do it by running the following command. The requirements.txt file is inside this repository, you will see it when you clone the repo.

$ pip3 install -r 'requirements.txt' 

This should install the required packages. You can check the version by running

$ pip3 freeze

If the packages are in the wrong version, you can try to upgrade them by running

$ pip3 install --upgrade name_of_the_package

Download kindlegen.

$ wget https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz | tar xvzf kindlegen

Copy kindlegen into '/usr/local/bin' and grant execute permissions for MOBI conversion.

$ sudo cp -R '/home/user/Desktop/kindlegen' '/usr/local/bin'

$ sudo chmod +rwx '/usr/local/bin/kindlegen' 

Run python file for KCC GUI

$ python3 kcc.py

If everything goes well, you now should be able to use it.

Create destop file in '~/.local/share/applications' with codes:

#!/usr/bin/env xdg-open

[Desktop Entry]
Type=Application
Name=Kindle Comic Converter
Icon=kcc
Exec=python3 '/home/user/kcc/kcc.py'
Terminal=false
StartupWMClass=kcc
Name[en_US]=Kindle Comic Converter

Copy icon file into '/home/user/.local/share/icons'

$ sudo cp -R 'icons/comic2ebook.png' '/home/user/.local/share/icons'

INPUT FORMATS

KCC can understand and convert, at the moment, the following input types:

  • Folders containing: PNG, JPG, GIF or WebP files
  • CBZ, ZIP (With 7z executable)
  • CBR, RAR (With 7z executable)
  • CB7, 7Z (With 7z executable)
  • PDF (Only extracting JPG images)

USAGE

Should be pretty self-explanatory. All options have detailed information in tooltips. After completed conversion, you should find ready file alongside the original input file (same directory).

Please check our wiki for more details.

CLI version of KCC is intended for power users. It allows using options that might not be compatible and decrease the quality of output.

Standalone kcc-c2e.py usage:

Usage: kcc-c2e [options] comic_file|comic_folder

Options:
  MAIN:
    -p PROFILE, --profile=PROFILE
                        Device profile (Available options: K1, K2, K34, K578,
                        KDX, KPW, KPW5, KV, KO, KoMT, KoG, KoGHD, KoA, KoAHD,
                        KoAH2O, KoAO, KoC, KoL, KoF) [Default=KV]
    -m, --manga-style   Manga style (right-to-left reading and splitting)
    -q, --hq            Try to increase the quality of magnification
    -2, --two-panel     Display two not four panels in Panel View mode
    -w, --webtoon       Webtoon processing mode

  OUTPUT SETTINGS:
    -o OUTPUT, --output=OUTPUT
                        Output generated file to specified directory or file
    -t TITLE, --title=TITLE
                        Comic title [Default=filename or directory name]
    -f FORMAT, --format=FORMAT
                        Output format (Available options: Auto, MOBI, EPUB,
                        CBZ, KFX, MOBI+EPUB, KFX+EPUB) [Default=Auto]
    -b BATCHSPLIT, --batchsplit=BATCHSPLIT
                        Split output into multiple files. 0: Don't split 1:
                        Automatic mode 2: Consider every subdirectory as
                        separate volume [Default=0]

  PROCESSING:
    -n, --noprocessing  Do not modify image and ignore any profil or
                        processing option
    -u, --upscale       Resize images smaller than device's resolution
    -s, --stretch       Stretch images to device's resolution
    -r SPLITTER, --splitter=SPLITTER
                        Double page parsing mode. 0: Split 1: Rotate 2: Both
                        [Default=0]
    -g GAMMA, --gamma=GAMMA
                        Apply gamma correction to linearize the image
                        [Default=Auto]
    -c CROPPING, --cropping=CROPPING
                        Set cropping mode. 0: Disabled 1: Margins 2: Margins +
                        page numbers [Default=2]
    --cp=CROPPINGP, --croppingpower=CROPPINGP
                        Set cropping power [Default=1.0]
    --blackborders      Disable autodetection and force black borders
    --whiteborders      Disable autodetection and force white borders
    --forcecolor        Don't convert images to grayscale
    --forcepng          Create PNG files instead JPEG
    --mozjpeg           Create JPEG files using mozJpeg
    --maximizestrips    Turn 1x4 strips to 2x2 strips

  CUSTOM PROFILE:
    --customwidth=CUSTOMWIDTH
                        Replace screen width provided by device profile
    --customheight=CUSTOMHEIGHT
                        Replace screen height provided by device profile

  OTHER:
    -h, --help          Show this help message and exit

Standalone kcc-c2p.py usage:

Usage: kcc-c2p [options] comic_folder

Options:
  MANDATORY:
    -y HEIGHT, --height=HEIGHT
                        Height of the target device screen
    -i, --in-place      Overwrite source directory
    -m, --merge         Combine every directory into a single image before splitting

  OTHER:
    -d, --debug         Create debug file for every split image
    -h, --help          Show this help message and exit

CREDITS

KCC is made by Ciro Mattia Gonano and Paweł Jastrzębski.
This fork and beta versions are maintained by Darodi .

This script born as a cross-platform alternative to KindleComicParser by Dc5e (published here).

The app relies and includes the following scripts:

SAMPLE FILES CREATED BY KCC

PRIVACY

KCC is initiating internet connections in two cases:

  • During startup - Version check.
  • When error occurs - Automatic reporting on Windows and macOS.

KNOWN ISSUES

Please check wiki page.

COPYRIGHT

Copyright (c) 2012-2019 Ciro Mattia Gonano and Paweł Jastrzębski.
KCC is released under ISC LICENSE; see LICENSE.txt for further details.