https://github.com/saharmor/script-kiddy
https://github.com/saharmor/script-kiddy
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/saharmor/script-kiddy
- Owner: saharmor
- License: apache-2.0
- Created: 2024-12-26T19:06:25.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-03-11T04:42:47.000Z (3 months ago)
- Last Synced: 2025-05-08T19:08:18.452Z (about 1 month ago)
- Language: TypeScript
- Size: 207 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Images to PDF Converter
This script combines images from a directory into a single PDF file, using the image filenames as page numbers.
## Requirements
Install the required Python packages:
```bash
pip install pillow reportlab numpy
```## Usage
1. Place your images in the `./input` directory (will be created if it doesn't exist)
2. Name your images with numbers corresponding to the page order (e.g., `0.jpg`, `1.jpg`, `2.jpg`, etc.)
3. Run the script:```bash
python images_to_pdf.py
```By default, this will:
- Look for images in the `./input` directory
- Create a PDF file named `output.pdf`## Command Line Options
You can customize the input directory and output filename:
```bash
python images_to_pdf.py --input ./my_images --output my_document.pdf
```Or using the short form:
```bash
python images_to_pdf.py -i ./my_images -o my_document.pdf
```### Generate Test Images
The script can generate test images for demonstration:
```bash
python images_to_pdf.py --test
```You can specify the number of test images to generate:
```bash
python images_to_pdf.py --test --num-test-images 10
```## Supported Image Formats
The script supports the following image formats:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- TIFF (.tiff)## How It Works
1. The script scans the input directory for image files
2. It extracts page numbers from filenames (e.g., `1.jpg` → page 1)
3. Images are sorted by page number
4. Each image is added to the PDF, scaled to fit the page while maintaining aspect ratio
5. The final PDF is saved to the specified output file