Guide
Create thumbnails
Generate thumbnails from images, PDFs and video.
The thumbnail operation generates a small preview image from an existing image, PDF, or video. It is ideal for building galleries, file previews, or page-by-page document overviews without downloading the full source file.
How it works
Call the operation under the conversion array with "category": "operation" and "target": "thumbnail". Point input at your source file and tune the output with the options below.
Options
| Option | Description |
|---|---|
thumbnail_target |
Output image format: png or jpg. |
width |
Target width of the thumbnail in pixels. |
height |
Target height of the thumbnail in pixels. |
dpi |
Render resolution (dots per inch) used when rasterizing PDF pages. |
pages |
Which source pages to render, e.g. "first" or a range list like "1-3,5" (applies to PDF and multi-page input). |
allow_multiple_outputs |
When several pages are requested, set to true to receive one thumbnail file per page instead of a single combined output. |
Example: PDF to first-page PNG thumbnail
This job renders the first page of a PDF as a 300 px-wide PNG thumbnail.
{
"input": [
{
"type": "remote",
"source": "https://example-files.online-convert.com/document/pdf/example.pdf"
}
],
"conversion": [
{
"category": "operation",
"target": "thumbnail",
"options": {
"thumbnail_target": "png",
"width": 300,
"pages": "first",
"dpi": 150
}
}
]
}
Submit the job with your API key in the lowercase x-oc-api-key header:
curl -X POST "https://api.api2convert.com/v2/jobs" \
-H "x-oc-api-key: <your-api-key>" \
-H "Content-Type: application/json" \
-d @job.json
Multiple page thumbnails
To produce a separate thumbnail for each of several pages, request a page range and enable allow_multiple_outputs.
{
"conversion": [
{
"category": "operation",
"target": "thumbnail",
"options": {
"thumbnail_target": "jpg",
"width": 200,
"height": 280,
"pages": "1-3,5",
"allow_multiple_outputs": true
}
}
]
}
The same operation works for video input, producing a single preview frame. For full document or image format conversions instead of previews, see the format explorer.
Live options
Loading options…