GithubHelp home page GithubHelp logo

mozayed007 / images-pdf-converter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10 KB

A tool script that converts images in sub-directories to one single PDF in the parent directory

License: MIT License

Python 100.00%

images-pdf-converter's Introduction

Images PDF Converter (Manga Version)

A tool script that converts images ( .jpg / .png ) in sub-directories to one single PDF in the parent directory.

This Tool was tailored for (Free manga Downloader, AKA : FMD): "https://github.com/dazedcat19/FMD"

  • The FMD downloads the manga pages as images each chapter is a subdirectory and the check condition for clearing parent folder from subfolders' pdfs spam (deleting chapters pdfs) . The finalized script is generic and will delete all pdfs in the parent folder that ain't the merged pdf, so take care that you don't put other important pdfs in the parent folder !!!

Usage

The script takes in two arguments:

  • folder: The path to the manga folder that contains the images.
  • -o, --output: (optional) The name of the output pdf file. If not provided, the pdf file will be named after the manga folder.

Functionality

  1. The script first initializes an argument parser to handle the input arguments.
  2. The script then initializes a pdf merger from the PyPDF2 library.
  3. The script then changes the current working directory to the parent folder specified in the input argument.
  4. The script then iterates through the subfolders in the parent folder, and for each subfolder, it converts all jpg and JPG images to pdf.
  5. After all the images have been converted, the script iterates through the files in the parent folder and appends all pdf files to the pdf merger.
  6. The script then writes the merged pdf to the parent folder with the specified output name or the name of the parent folder if no output name is provided.
  7. The script then closes the pdf merger and deletes the individual chapter pdfs.

Requirements

  • Python 3
  • PyPDF2
  • PIL
  • img2pdf
  • send2trash

Note

Make sure to install the required packages before running the script. Use command pip install -r requirements.txt to install all the packages at once if you have a requirements.txt file.

images-pdf-converter's People

Contributors

mozayed007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.