PDF to JPG by API: thumbnails and previews at the right DPI

Render PDF pages to JPG with one API call for thumbnails, previews and social images. Picking a DPI, which pages to render, the ZIP rule, and what it costs.

A PDF rendered into three page thumbnails as JPG images at 150 DPI

Apps that store PDFs usually need a picture of them: a thumbnail in a list, a preview before download, an image for a social post. The PDF to Image API renders pages to JPG or PNG in one call.

curl https://api.justapi.tech/v1/pdf/to-images \
  -H "Authorization: Bearer ak_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source": {"url": "https://files.example.com/brochure.pdf"}, "options": {"format": "jpg", "dpi": 72, "quality": 75, "pages": "1"}}'

Pick the DPI from the size you show

DPI means pixels per inch of the page. A US Letter page is 8.5 inches wide, so:

DPI Letter page width Good for
36 306 px list thumbnails
72 612 px small previews
96 816 px on-screen previews
150 1,275 px readable previews, social images
300 2,550 px print, zoomable detail

Render at the size you display, or twice that for high-density screens. Rendering a thumbnail at 300 DPI wastes time and storage.

Render only the pages you need

pages takes the usual lists: 1 for a cover thumbnail, 1-3 for a preview strip. Leaving it out renders every page, up to 200 per call.

One image or a ZIP

One page comes back as the image itself, ready to store or show. Several come back as a ZIP named page-1.jpg, page-2.jpg and so on. Check result.content_type: image/jpeg, image/png or application/zip.

For thumbnails, one call per file with pages: "1" is simplest, because you get an image you can use directly.

JPG quality

For JPG, quality runs from 30 to 95; the default 85 is a good balance. For thumbnails, 70 is usually enough and makes smaller files. For text-heavy pages that must stay crisp, consider PNG; see PNG or JPG, and which DPI.

Encrypted and damaged files

An encrypted PDF fails with encrypted_pdf; unlock it first. A damaged one may render after repair. Both failures are free.

Cost

$0.008 per call at the first tier, whether you render one page or 200.

The free PDF to JPG tool lets you compare DPI settings on your own file.