Skip to content

Deadlydav/bulkpdfcolorinverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BULK PDF Color Inverter

This Python script automates the process of inverting colors in PDF documents giving a Dark Mode feeling. Works great for kindle like device that don't offer a dark mode. It also keeps your folder structure for convenience

Features

  • Color Inversion: Efficiently inverts colors of PDF pages.
  • Text and Image Detection: Differentiates between text-heavy and image-heavy pages for optimal processing.
  • Multi-threaded Processing: Uses concurrent threads for faster processing of multiple PDF files.
  • Automatic PDF Conversion: Converts processed pages back into PDF format without converting everything into images first, saving space.

Requirements

  • Python 3.6+
  • PyMuPDF (fitz) library
  • Pillow (PIL) library
  • PyPDF2 library

Installation

  1. Clone the repository:

git clone https://github.com/Deadlydav/bulkpdfcolorinverter.git

  1. Install the required libraries:

pip install PyMuPDF pillow PyPDF2

Usage

  1. Modify the input_folder and output_folder variables at the end of the bulkpdfinverter.py to specify your input PDF directory and desired output directory.
    # Define input and output directories
    input_folder = '/path/to/your/input/folder'
    output_folder = '/path/to/your/output/folder'
  1. Run the script:

python3 invert_pdf_colors.py

  1. Inverted PDFs will be saved in the output folder structure.

Configuration

Adjust the following parameters in invert_pdf_colors.py as needed:

  • dpi: DPI resolution for image conversion.
  • contrast_factor: Adjusts contrast enhancement for image-heavy pages.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

Contributing

Pull requests are welcome.

About

bulk pdf color inverter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages