## Why Convert PDF to Images?
For thumbnails, content extraction, Photoshop editing, compatibility, or OCR preparation.
## Ghostscript — The Most Powerful Tool
```bash
# All pages to JPEG (150 DPI)
gs -dNOPAUSE -dBATCH -sDEVICE=jpeg -r150 -sOutputFile=page_%02d.jpg document.pdf
# First page only
gs -dNOPAUSE -dBATCH -dFirstPage=1 -dLastPage=1 -sDEVICE=jpeg -r150 -sOutputFile=cover.jpg doc.pdf
```
## Poppler (pdftoppm) — Fast on Linux/macOS
```bash
sudo apt install poppler-utils # Ubuntu/Debian
brew install poppler # macOS
pdftoppm -r 150 -png document.pdf page # → page-1.png, page-2.png...
pdftoppm -r 150 -jpeg -jpegopt quality=85 document.pdf page
pdftoppm -r 150 -png -f 2 -l 5 document.pdf page # Pages 2-5 only
```
## Python with pdf2image
```python
from pdf2image import convert_from_path
pages = convert_from_path('document.pdf', dpi=150)
for i, page in enumerate(pages, 1):
page.save(f'page_{i:02d}.jpg', 'JPEG', quality=85)
```
## What DPI to Choose?
| Use Case | DPI | Notes |
|----------|-----|-------|
| Web thumbnail | 72 | Small and fast |
| HD display | 150 | Good quality/size balance |
| Print / OCR | 300 | Sharp text |
| High-quality archive | 600 | Critical documents |
## Conclusion
**Ghostscript** for bulk server-side conversion. **pdf2image** for Python. Online tools for occasional use. DPI is the most critical parameter: 150 for screen, 300 for print and OCR.
Guide