A command-line tool to convert PDF files into JPEG images with support for sampling and parallel processing.
- Convert PDFs to JPEGs: Transform PDF pages into high-quality JPEG images.
- Page Sampling: Specify the percentage of pages to convert from each PDF.
- Parallel Processing: Utilize multiple CPU cores for faster conversions.
- Progress Indicator: Visualize the conversion progress with a progress bar.
-
Clone the repository:
git clone https://github.com/yourusername/pdf-to-images-cli.git cd pdf-to-images-cli -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
Run the CLI tool using the following command:
python pdf_to_images_cli.py [PDF_PATHS] [--sample SAMPLE_PERCENTAGE]PDF_PATHS: One or more paths to the PDF files you want to convert.
--sample: Percentage of pages to sample from each PDF (0-100). Defaults to100(all pages).
-
Convert all pages of a single PDF:
python pdf_to_images_cli.py /path/to/file.pdf
-
Convert 50% of pages from multiple PDFs:
python pdf_to_images_cli.py /path/to/file1.pdf /path/to/file2.pdf --sample 50
Converted JPEG images will be saved in subdirectories named after each PDF file within the same directory as the PDFs.