Skip to content
Screenshot API · Use case

Get faster screenshot API responses and smaller files at volume

A fast screenshot API call is mostly a matter of not doing work you will throw away. When you capture thousands of pages for thumbnails, link previews, monitoring or a search index, seconds and kilobytes add up, and most of the cost hides in defaults: metadata you do not read, retina density you do not display, timers that wait longer than needed. Each one is a single Screenshot API option away from being switched off.

A page captured as a compressed JPEG at 1x density
Generated live by the API call below: metadata skipped, JPEG at quality 60, 1× density.
The problem

Default screenshots do more work than a high-volume pipeline needs

Every screenshot request also extracts the page metadata, renders at the device’s native pixel density and waits for the page to settle. Those defaults make sense for a one-off capture and cost time on a batch of ten thousand thumbnails.

The usual reaction is to optimize after the fact: download the PNG, resize it, recompress it and upload it again. That doubles the storage traffic, adds an image pipeline to maintain and does nothing for the response time, because the browser already rendered every pixel you later threw away.

Turning off metadata with meta: false is usually the single biggest speedup. After that, a lower deviceScaleFactor, JPEG with a quality setting and selector-based waits shrink both the response time and the bytes you store and serve.

How it works

How to make screenshot API calls faster and images smaller

Apply the settings in this order. Each one is optional and each one is a plain request option, listed with the rest in the screenshot caching and performance guide.

1 · Skip what you do not need
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url, size_pretty: size } = await microlink.screenshot(
  'https://example.com',
  {
    meta: false,
    type: 'jpeg',
    quality: 60,
    viewport: { deviceScaleFactor: 1 }
  }
)

meta: false skips metadata extraction, JPEG at quality 60 compresses harder than the default of 80, and deviceScaleFactor: 1 renders one device pixel per CSS pixel. size_pretty in the response shows the resulting file size.

2 · Wait for a selector, not a timer
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot('https://example.com', {
  meta: false,
  waitUntil: 'domcontentloaded',
  waitForSelector: 'h1'
})

The capture fires as soon as the heading is in the page instead of waiting for every image and third-party script. Screenshots of JavaScript-rendered pages covers the full set of wait options.

3 · Skip JavaScript on static pages
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot('https://example.com/docs', {
  meta: false,
  javascript: false
})

javascript: false disables script execution in the browser page. Use it for server-rendered pages that are complete without it, and leave it on for client-rendered apps.

4 · The same request as a URL
curl 'https://api.microlink.io/?url=https%3A%2F%2Fexample.com&meta=false&screenshot.type=jpeg&screenshot.quality=60&viewport.deviceScaleFactor=1'

The request runs on the free endpoint. Compare the x-response-time header before and after to measure the gain on your own targets, and look for x-fetch-mode: skipped to confirm metadata was bypassed.

Parameters used
  • meta false skips metadata detection and x-fetch-mode reports skipped. Default true.
  • screenshot.type png (default) or jpeg. JPEG gives smaller files when transparency is not needed.
  • screenshot.quality JPEG compression from 0 to 100; 80 by default. Ignored for PNG output.
  • viewport deviceScaleFactor: 1 renders a quarter of the pixels of a 2x capture. Partial values merge with the device defaults.
  • waitForSelector Finishes as soon as the element exists instead of a fixed delay.
  • javascript false skips script execution for pages that are complete without it. Default true.

Keep adblock and animations at their defaults: blocking third-party requests and disabling transitions already make captures faster and more stable. Avoid fullPage when a viewport or an element capture is enough.

Why it works

Why these screenshot speed settings matter at volume

Each option removes work the browser or the network would otherwise do on every single request.

01 · Metadata off
The largest single speedup for screenshot-only jobs.
Metadata detection is a full extraction step that runs next to the capture. If you only need the picture, meta: false skips all of it, and the response header confirms it with x-fetch-mode: skipped.

When you do need some metadata next to the image, fetch only the metadata fields you need instead of all of them.

02 · Fewer pixels
Density and format decide the bytes you store.
A 2× capture has four times the pixels of a 1× capture, and JPEG at quality 60 is a fraction of a lossless PNG on photographic pages. Thumbnails and previews rarely need either extreme.

The CDN may still serve an optimized format such as WebP to compatible browsers, so the stored asset and the delivered asset can differ. Cropping to a single element is the other way to cut pixels.

03 · Wait for a condition
Selector waits finish early; timers finish late.
A selector wait returns the moment the element appears. Combined with domcontentloaded it skips fonts, images and third-party scripts that do not change the content you capture.

When not to: pixel-perfect design reviews and visual regression need 2× density and PNG. Save the speed settings for previews, thumbnails and monitoring.

FAQ

What is the biggest speedup for screenshot API requests?

Setting meta to false. Metadata extraction is the most expensive step that a screenshot-only request does not need, and skipping it is reflected in the x-fetch-mode: skipped response header.

How do I reduce screenshot file size with JPEG quality?

Set screenshot.type to jpeg and lower screenshot.quality from its default of 80. It depends on the page, but photographic and colorful pages compress several times better as JPEG at quality 60 to 80. PNG stays lossless and keeps transparency, which JPEG cannot.

Does a cached screenshot still take time to generate?

No. A cache hit is served from the edge without launching a browser, and it does not count against your quota. Speed settings matter for the first capture of each URL and for pipelines with many unique URLs, while ttl decides how long the rest stay cached.

Is there a screenshot option that prioritizes speed automatically?

The SDK exposes optimizeForSpeed on the screenshot method, which prioritizes capture speed over image size and fidelity and is off by default. The explicit settings above give you finer control over the trade-off.

Does a lower deviceScaleFactor make screenshots blurry?

At deviceScaleFactor 1 the image has one pixel per CSS pixel, which looks sharp on standard displays and slightly soft on high-density screens at full size. For thumbnails and previews displayed smaller than the viewport, the difference is not visible and the file is much lighter.
Related use cases

Solve the next problem with the same API

Screenshots under traffic spikes

Absorb bursts of screenshot traffic without a browser pool: no throttling, parallel requests and a cache whose hits are free.

Screenshots of JavaScript-rendered pages

Wait for a selector, a lifecycle event or a delay so single-page apps and lazy sections finish rendering before capture.

Screenshot a single element

Crop the capture to one CSS selector, such as a chart or a pricing table, with a transparent background if you need it.

Mobile screenshots at any viewport

Emulate an iPhone, a Pixel, an iPad or any custom viewport and capture the page exactly as those visitors see it.

Dynamic Open Graph images

Point og:image at an API URL and every share shows a current, cached screenshot of the page.

Only the fields you need

Include or exclude normalized fields per request and trim the JSON for faster, lighter metadata calls.

Ready for leaner screenshots?

Skip the work you do not need and capture faster on every plan. Start on the free tier and measure the difference on your own pages.