Package: manga2pdf
manga2pdfOverviewThis 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.RequirementThe script uses the Python librariesimg2pdfandpikepdfto do the conversion.
Moreover, it useslxmlto read the EPUB files andrarfileto read the RAR archive files.It requires the installation of these packages in order to work properly.NoteThis 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, or001.jpg,002.jpg,003.jpg, and so on. This will ensure that the pages are converted and compiled in the correct order.UsageThis script can take input in the form ofzip,cbz,rar,cbr,epubfiles 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:Theinput_pathargument represents the path to the input file. To execute the Python script correctly, specify theinput_pathargument as the path to the input file containing manga or comic images in any of the supported formats, such aszip,cbz,rar,cbr,epub, or a directory containing images in formats such asjpg,jpeg,png,gif, orbmp.Theoutput_pathargument 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--outputoption is not specified, the output file name will be automatically generated based on the name of the input file or directory.Thepagelayoutparameter can take in the following values:SinglePage-> Single page displayOneColumn-> Enable scrollingTwoPageLeft-> Spread viewTwoColumnLeft-> Spread view with scrolling(default)TwoPageRight-> Separate Cover, Spread ViewTwoColumnRight-> Separate Cover, Scrolling Spread ViewThepagemodeparameter can take in the following values:(default)UseNone-> Neither document outline nor thumbnail images visibleUseOutlines-> Document outline visibleUseThumbs-> Thumbnail images visibleFullScreen-> Full-screen modeUseOC-> Optional content group panel visibleUseAttachments-> Attachments panel visibleThedirectionparameter can take in the following values:L2R-> Left Binding(default)R2L-> Right BindingBy default, the page layout is set toTwoPageRightand the reading direction toR2L, which are suitable for Japanese manga.The-jor--jpegoption converts images to JPEG format before including them in the output PDF file, resulting in a smaller file size. Similarly, the-gor--grayscaleoption can be used to convert images to grayscale and reduce the size of the resulting PDF file. The program outputs the converted image in the specified format and compresses the PDF file accordingly.NoteWhen the original image is already in the JPEG format, using the-jor--jpegoption will have no effect. Similarly, if the original image is already grayscale, using the-gor--grayscaleoption will have no effect. Also, if none of these options are used, the resulting PDF file will not be compressed.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.InstallationInstalling from PyPITo install the latest version of the package from PyPI, run the following command:$ pip install manga2pdfInstalling directly from the Git repositoryTo install the package directly from the Git repository, run the following command:$ pip install git+https://github.com/mashu3/manga2pdf.gitInstalling by cloning the Git repositoryTo install the package by cloning the Git repository, follow these steps:$ git clone https://github.com/mashu3/manga2pdf.git
$ cd manga2pdf/
$ pip install .NoteIt is recommended to install the package from PyPI, but if you want to try out the latest changes, you can install it from the Git repository.ExamplesTo convertmy_manga.ziptomy_manga.pdfusing the default settings:$ manga2pdf my_manga.zipTo convertmy_manga.epubtomy_manga_spread.pdfwith a spread view and right binding:$ manga2pdf my_manga.epub -o my_manga_spread.pdfTo convertmy_comic.epubtomy_comic.pdfwith a TwoPage view and left binding:$ manga2pdf my_comic.epub -o my_comic.pdf -p TwoPageLeft -d L2RGUITo launch the graphical user interface:$ manga2pdf -guiThe interface supports English and Japanese, and all settings that can be specified via the command line are available.
The GUI is currently under development and additional features are planned for future updates.Authormashu3