Skip to main content

Convert manga/comic files(zip, epub, etc.) or directory containing image files (jpg, png, etc.) to PDF.

Project description

manga2pdf

Overview

This Python script is specifically designed to convert manga and comic files, including various formats such as zip, epub, and directories containing image files, to PDF format.

The resulting PDF files are optimized to resemble Japanese manga in terms of page layout and direction. By default, the script uses a "TwoPageRight" page layout that displays two pages side-by-side for a spread view, and a "R2L" (right-to-left) reading direction that is commonly used in Japanese manga.

Requirement

The script uses the Python libraries img2pdf and pikepdf to do the conversion. Moreover, it uses BeautifulSoup to read the EPUB files and rarfile to read the RAR archive files.

It requires the installation of these packages in order to work properly.

Note

  • This script can only handle DRM-free fixed-layout EPUB files.
  • Please ensure that the image files you input are named in numerical order according to their page sequence. For example, page_01.jpg, page_02.jpg, page_03.jpg, and so on, or 001.jpg, 002.jpg, 003.jpg, and so on. This will ensure that the pages are converted and compiled in the correct order.

Usage

This script can take input in the form of zip, cbz, rar, cbr, epub files or directories containing images (jpg, jpeg, png, gif, bmp) of manga or comic pages.

The program can be executed from the command line with the following options:

  • The input_path argument represents the path to the input file. To execute the Python script correctly, specify the input_path argument as the path to the input file containing manga or comic images in any of the supported formats, such as zip, cbz, rar, cbr, epub, or a directory containing images in formats such as jpg, jpeg, png, gif, or bmp.
  • The output_path argument is the path to the output PDF file. To use the script, simply run the Python script with the path to the input file or directory as the argument. If the --output option is not specified, the output file name will be automatically generated based on the name of the input file or directory.
  • The pagelayout argument is the page layout of the PDF file. The pagelayout parameter can take in the following values:
    • SinglePage -> Single page display
    • OneColumn -> Enable scrolling
    • TwoPageLeft -> Spread view
    • TwoColumnLeft -> Spread view with scrolling
    • (default) TwoPageRight -> Separate Cover, Spread View
    • TwoColumnRight -> Separate Cover, Scrolling Spread View
  • The direction argument is the reading direction of the PDF file. The direction parameter can take in the following values:
    • L2R -> Left Binding
    • (default) R2L -> Right Binding

By default, the page layout is set to TwoPageRight and the reading direction to R2L, which are suitable for Japanese manga.

Note

  • Any images in formats other than .jpg or .jpeg will be converted to .jpg format and compressed during the conversion process.

There is a possibility that the script may not be able to handle files in unexpected formats correctly, which may result in errors or unexpected output.

Installation

To install the package by cloning the Git repository, follow these steps:

$ git clone https://github.com/mashu3/manga2pdf.git
$ cd manga2pdf/
$ pip install .

To install the package directly from the git repository, you can use the following command:

$ pip install git+https://github.com/mashu3/manga2pdf.git

Examples

  • To convert my_manga.zip to my_manga.pdf using the default settings:
$ manga2pdf my_manga.zip
  • To convert my_manga.epub to my_manga_spread.pdf with a spread view and right binding:
$ manga2pdf my_manga.epub -o my_manga_spread.pdf
  • To convert my_comic.epub to my_comic.pdf with a TwoPage view and left binding:
$ manga2pdf my_comic.epub -o my_comic.pdf -p TwoPageLeft -d L2R

Author

mashu3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manga2pdf-0.0.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

manga2pdf-0.0.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file manga2pdf-0.0.2.tar.gz.

File metadata

  • Download URL: manga2pdf-0.0.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for manga2pdf-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d36bbffd93534cc17a04a8f6da33887df9c750b65f35e80a3ed45a6845717f51
MD5 b469bfeda7a969005f86125b3a6531d3
BLAKE2b-256 b0feab5bbe74723c1ce3fcded92fee2d61fab242d29195416390da0d2decaac1

See more details on using hashes here.

File details

Details for the file manga2pdf-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: manga2pdf-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for manga2pdf-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba8a8320b903e75080f50b31950847ccb649cf448023b931ddb420fb3da3f0da
MD5 c4ea7d1a1d6cfec3b114ad266776f7dd
BLAKE2b-256 f5ea8ee4ca893cb038087478e015690adeb4db438a7658062653b6abe211a706

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page