How to convert PDF pages to PNG or JPEG images with an API

POST a PDF to /v1/pdf/to-images. It renders each selected page to a PNG or JPEG and returns the images as base64.

Request

format is png (default) or jpeg; dpi is 36 to 300 (default 150); pages selects pages (default all, at most 20 per call); jpeg_quality is 30 to 95; grayscale is true or false.

curl (no free tier: an unpaid call returns 402)
curl -s -X POST https://tanod.dev/v1/pdf/to-images \
  -H 'content-type: application/json' \
  -d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "format": "png", "dpi": 72, "pages": "1"}'

The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:

save the result to a file
curl -s -X POST https://tanod.dev/v1/pdf/to-images \
  -H 'content-type: application/json' \
  -d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "format": "png", "dpi": 72, "pages": "1"}' \
  | jq -r '.files[0].data_base64' | base64 -d > page-1.png

Response

Response (example from the API spec, trimmed)
{
  "operation": "to-images",
  "input_bytes": 13264,
  "input_pages": 1,
  "format": "png",
  "dpi": 72,
  "files": [
    {
      "name": "page-1.png",
      "content_type": "image/png",
      "bytes": 5915,
      "page": 1,
      "width": 595,
      "height": 842,
      "dpi": 72,
      "data_base64": "iVBORw0KGgoAAAAN"
    }
  ],
  "file_count": 1,
  "output_bytes": 5915,
  "untrusted_content": true
}

Limits and caveats

Priced on the request. The price follows your pages value, not the document, so a closed selection of 5 pages or fewer is the lower price.

Pixel limit. A page over 36 megapixels is rendered at a lower dpi; each image reports the dpi it used. Rendering uses PDFium with no JavaScript.

Output over 15 MB is a 413 and is not charged. Encrypted input is a 422 pdf_encrypted; unlock it first.

No free tier. An unpaid call returns a 402 with payment requirements.

Doing this by hand? Use the free PDF to JPG converter in your browser.

Price and free allowance

USD 0.005 for a closed pages selection of at most 5 pages (such as 1-3 or last), USD 0.01 otherwise (all pages or an open range such as 2-; at most 20 pages), paid in USDC on Base with x402. No free tier. MCP tool: pdf_to_images at https://tanod.dev/mcp.

All endpoints →

Related guides: How to convert images (JPG, PNG, WebP) to a PDF with an API, How to OCR a scanned PDF into a searchable PDF with an API, How to extract text from a PDF URL. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.