Future Rust candidate (tier 2): No Rust port yet. A rewrite would target PDF/image rasterization throughput; keep Python if you rely on PyMuPDF/Pillow parity.
Universal CLI tool for converting files (media primarily). Supports PDF→PNG/JPG and image format conversion with resize, quality control, and batch processing. Built with Typer and Rich.
- PDF to image — Convert PDF pages to PNG, JPG, WebP, BMP, or TIFF (via PyMuPDF)
- Image conversion — Convert between PNG, JPG, WebP, BMP, TIFF, GIF (via Pillow)
- Resize — Width, height, or max-dimension (preserve aspect ratio)
- Quality control — JPEG/WebP quality (1–100)
- Batch processing — Directories, globs, recursive mode
pip install -r requirements.txtOr install dependencies directly:
pip install typer rich PyMuPDF Pillow# PDF to PNG
pyconvert pdf document.pdf -o ./output
# Image format conversion
pyconvert img photo.png -f jpg -q 90
# Check supported formats and backends
pyconvert list-formats| Command | Description |
|---|---|
pdf |
Convert PDF(s) to images (PNG, JPG, etc.) |
img |
Convert images to another format, resize |
list-formats |
Show supported formats and backend status |
Convert PDF files to images. Each page becomes a separate image file (e.g. report_page1.png, report_page2.png).
pyconvert pdf PATHS [OPTIONS]| Option | Short | Default | Description |
|---|---|---|---|
PATHS |
— | (required) | PDF file(s) or directory to convert |
--out |
-o |
. |
Output directory |
--format |
-f |
png |
Output format: png, jpg, jpeg, webp, bmp, tiff |
--dpi |
— | 150 |
Resolution (DPI) for rendering |
--quality |
-q |
85 |
JPEG/WebP quality (1–100) |
--first |
— | — | First page (1-based) |
--last |
— | — | Last page (1-based) |
--recursive |
-r |
false |
Recurse into subdirectories |
--overwrite |
— | false |
Overwrite existing output files |
--verbose |
-v |
false |
Show per-file progress |
pyconvert pdf document.pdf -o ./outputProduces ./output/document_page1.png, document_page2.png, etc.
pyconvert pdf report.pdf -f jpg -q 90 -o ./imagesOutputs JPG files with 90% quality.
pyconvert pdf report.pdf --dpi 300 -o ./high-resRenders at 300 DPI instead of the default 150.
pyconvert pdf report.pdf --first 1 --last 5 -o ./pagesOnly converts pages 1 through 5.
pyconvert pdf ./pdfs -o ./outputConverts all PDFs in ./pdfs (non-recursive).
pyconvert pdf ./pdfs -f jpg -q 90 -r -o ./imagesRecurses into subdirectories, converts to JPG at 90% quality.
pyconvert pdf *.pdf -o ./images --overwriteConverts all PDFs in the current directory and overwrites existing output.
Convert images to another format and optionally resize. Handles EXIF orientation automatically.
pyconvert img PATHS [OPTIONS]| Option | Short | Default | Description |
|---|---|---|---|
PATHS |
— | (required) | Image file(s) or directory to convert |
--out |
-o |
. |
Output directory |
--format |
-f |
png |
Output format: png, jpg, webp, bmp, tiff |
--quality |
-q |
85 |
JPEG/WebP quality (1–100) |
--width |
-W |
— | Output width (resize, preserve aspect) |
--height |
-H |
— | Output height (resize, preserve aspect) |
--max-dimension |
-M |
— | Max width or height (preserve aspect) |
--recursive |
-r |
false |
Recurse into subdirectories |
--overwrite |
— | false |
Overwrite existing output files |
--verbose |
-v |
false |
Show per-file progress |
--extensions |
-e |
png,jpg,... |
Input extensions when scanning dirs |
pyconvert img photo.png -f jpg -q 90Converts photo.png to photo.jpg at 90% quality in the current directory.
pyconvert img photo.png --width 800 -o ./resizedOutput width 800 px; height scales proportionally.
pyconvert img ./photos -f webp --max-dimension 1920 -r -o ./webRecurses ./photos, converts to WebP, scales down so no side exceeds 1920 px.
pyconvert img *.png -o ./output -f jpg -q 85pyconvert img ./raw -e "png,tiff,bmp" -f jpg -o ./jpgOnly processes PNG, TIFF, and BMP when scanning the directory.
pyconvert img banner.png --height 400 -o ./thumbnailspyconvert img logo.png --width 200 --height 200 -o ./iconsResizes to exactly 200×200 (may distort aspect ratio).
Shows which conversion backends are installed and what formats they support.
pyconvert list-formatsExample output:
┌──────────┬────────┬─────────────────────────────────────┐
│ Backend │ Status │ Formats │
├──────────┼────────┼─────────────────────────────────────┤
│ PyMuPDF │ ✓ │ PDF → PNG, JPG, WebP, BMP, TIFF │
│ Pillow │ ✓ │ PNG, JPG, WebP, BMP, TIFF, GIF ↔ … │
└──────────┴────────┴─────────────────────────────────────┘
- PDF → use
pdfwith--format,--dpi,--quality,--first/--last - Images → use
imgwith--format,--quality,--width/--height/--max-dimension - Use
-rfor recursive directory processing - Use
--verbosefor per-file progress - Use
list-formatsto verify backends