Skip to main content

pymupdf-img

Fast PDF to image converter with batch processing and multi-threading support using PyMuPDF.

Installation

pip install pymupdf-img
# or
uv pip install pymupdf-img

Quick start

Command Line

pdf2img document.pdf

Options:

  • -o, --output-dir: Output directory (default: output)
  • -p, --prefix: Image filename prefix
  • -r, --range: Page range, e.g., 1-10
  • -d, --dpi: Resolution in DPI (default: 95)
  • -e, --ext: Format: jpg, png, webp (default: jpg)
  • -q, --quality: Image quality 1-100 (default: 95)
  • -m, --max-size: Max width/height in pixels (default: 2500)
  • -b, --batch-size: Pages per batch (default: 25)
  • -a, --auto-alpha: PNG for transparency, otherwise ext format
from pymupdf_img import convert_pdf

# Basic conversion
images = convert_pdf("document.pdf")

# Advanced usage
images = convert_pdf(
    pdf_path="path/to/document.pdf",
    page_range=(1, 10),                 # None for all pages or (start, end) tuple
    output_dir="output/images",         # output directory
    img_prefix="img_",                  # prefix for image filenames
    dpi=150,                            # resolution
    ext="jpg",                          # output image format
    quality=95,                         # image quality for lossy formats
    max_size=2500,                      # max width/height in pixels
    batch_size=50,                      # number of pages to process per batch
    auto_alpha_format=True              # PNG if alpha channel detected, ext otherwise
)

Development

# Build the package
uv run python -m build
# Check the package
uv run twine check dist/* 
# Upload the package
uv run twine upload dist/*

Release files for pymupdf-img 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymupdf-img 0.1.1
File Size Uploaded
pymupdf_img-0.1.1.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymupdf-img 0.1.1
File Interpreter ABI Platform
pymupdf_img-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / pymupdf_img-0.1.1.tar.gz

Download URL pymupdf_img-0.1.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
51874e1b6829d3ddabcd7837a928c281f198a8428a033381cc4bb67e6167fe99
BLAKE2b-256 checksum
How to use checksums
75a5a2c06e98dedb608162582c5974848d1649d7dc5ed5dd15471fc6b4231408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / pymupdf_img-0.1.1-py3-none-any.whl

Download URL pymupdf_img-0.1.1-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8aaf524e29b84fa3eacf43dd25234968916fdacefd5b3460ca0cc077a3ecf08a
BLAKE2b-256 checksum
How to use checksums
90a3def31f04e2ed0dc8b064935fc24722fd43fd4e898fa3f9429106ae69d932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page