Features Full Page Screenshot Wait for Selector & Delay Block Cookie Banners Custom Viewport & Device Website to PDF HTML to Image Dark Mode Image Format & Quality MCP Server Use Cases Link Previews Visual Regression Testing Screenshots for AI Agents Pricing Docs Blog Log In Sign Up

Screenshot API Image Format — PNG, WebP, AVIF, JPEG

A screenshot is just an image file, and the format of that file affects everything downstream. PNG gives you pixel-perfect output but weighs 2-5 MB for a full-page capture. JPEG compresses aggressively but smears text and sharp edges. WebP splits the difference — smaller files with better quality — but not every system opens it natively. The screenshot API image format parameter lets you choose the right tradeoff for each use case: format sets the output type, quality controls the compression level for lossy formats.

screenshotrun supports six output formats: PNG, JPEG, WebP, AVIF, TIFF, and PDF. Each serves a different purpose. Picking the wrong one means either wasting bandwidth on oversized files or delivering blurry screenshots that look unprofessional. Picking the right one is a single parameter.

Why format matters more than resolution

Developers spend time tuning viewport sizes and waiting for the right selector, then save the result as a default PNG without thinking about it. For a single screenshot, that's fine. But when you're generating hundreds or thousands of captures — link previews for a directory, thumbnails for a dashboard, visual regression baselines — format directly impacts storage costs, page load times, and bandwidth bills.

A typical full-page screenshot at 1280px wide produces roughly:

FormatFile size (approx.)QualityBest for
PNG2-5 MBLosslessPixel-perfect archives, visual regression baselines
JPEG (quality 80)200-500 KBGoodThumbnails, previews, large batches
WebP (quality 80)150-400 KBVery goodWeb display, modern applications
AVIF (quality 80)100-300 KBExcellentMaximum compression, cutting-edge apps
TIFF5-15 MBLosslessPrint, archival, professional editing
PDF100-500 KBVector + rasterDocuments, reports, invoices

Switching from PNG to WebP at quality 80 typically reduces file size by 70-80% with no visible quality loss in web display. At 10,000 screenshots per month, that's the difference between 30 GB and 4 GB of storage.

Setting the format

Pass format as a string. The default is png.

curl -X POST https://screenshotrun.com/api/v1/screenshots \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "webp",
    "quality": 85
  }'

The quality parameter applies to lossy formats only — JPEG, WebP, and AVIF. It accepts an integer from 1 (maximum compression, lowest quality) to 100 (minimum compression, highest quality). PNG and TIFF ignore this parameter since they're lossless. PDF has its own rendering pipeline and doesn't use pixel-based quality settings.

// Node.js — WebP at quality 90 for high-quality web display
const response = await fetch('https://screenshotrun.com/api/v1/screenshots', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://stripe.com',
    format: 'webp',
    quality: 90,
    full_page: true
  })
});

When to use each format

PNG — the safe default. Lossless compression means every pixel is preserved exactly. Text renders crisply, thin lines stay sharp, and transparent backgrounds work (omit_background: true). The tradeoff is file size. Use PNG when accuracy matters more than bandwidth: visual regression testing baselines, legal evidence, accessibility audits, or any case where lossy compression could mask a real difference.

JPEG — smallest files for photographic content. JPEG compression works well for screenshots dominated by images, gradients, and photographs — e-commerce product pages, travel sites, photography portfolios. It struggles with sharp text, UI borders, and flat-color regions, producing visible artifacts around hard edges. Quality 80-85 is the sweet spot for screenshots: below 75, text starts to blur; above 90, the file size savings over PNG become negligible. JPEG doesn't support transparency.

WebP — the modern web standard. WebP delivers 25-35% smaller files than JPEG at equivalent quality, with noticeably better text rendering. It supports both lossy and lossless compression (though the API uses lossy with the quality parameter). Every modern browser supports WebP. If you're displaying screenshots on a web page, WebP is almost always the right choice. Quality 80-90 for display, 95+ for near-lossless archiving.

AVIF — maximum compression, newest format. AVIF pushes file sizes 20-30% smaller than WebP with equal or better visual quality. Text, gradients, and flat UI elements compress particularly well. The downside: AVIF encoding is slower (the API handles this, but it adds ~200ms to capture time), and older browsers and image viewers don't support it. Use AVIF when you control the display environment — your own app, modern dashboards, or systems where you've verified AVIF support.

TIFF — print and professional workflows. TIFF produces large, uncompressed files suitable for print production, professional image editing, and long-term archival. Most web applications should never use TIFF for screenshots — it's here for workflows that require it, like legal documentation systems, publishing pipelines, and tools that ingest TIFF specifically.

PDF — documents, not images. Setting format: "pdf" generates a PDF document rather than a raster image. The text is selectable, links are clickable, and the layout matches what a user would see if they printed the page from Chrome. PDF has its own set of parameters — pdf_landscape, pdf_page_format (A3, A4, A5, Letter, Legal, Tabloid), and margin controls. For details, see the website to PDF feature page.

Quality settings in practice

The quality parameter isn't linear. The visual difference between quality 60 and 80 is dramatic. The difference between 80 and 95 is subtle. The difference between 95 and 100 is invisible to the human eye but doubles the file size.

Here's a practical guide:

Quality rangeUse caseVisual result
50-65Tiny thumbnails (under 200px wide)Visible compression artifacts on close inspection
70-80Link previews, social cards, directory thumbnailsClean at normal viewing distance
80-90Documentation screenshots, marketing materialsSharp text, no visible artifacts
90-95High-quality display, portfolio piecesNear-lossless, very large files
95-100Only if lossless matters and PNG isn't an optionIndistinguishable from lossless

The default quality is 80, which works well for most use cases. Override it only when you have a specific reason — either you need smaller files (lower quality) or the output will be closely inspected (higher quality).

Format + other parameters

Format + full page: full-page screenshots are where format choice matters most. A full-page PNG of a long page can exceed 10 MB. The same capture in WebP at quality 80 might be 800 KB. If you're generating full-page captures at scale, switching to WebP or AVIF pays for itself in storage alone.

Format + retina: retina (2x) screenshots have four times the pixels of standard captures, and file sizes scale accordingly. A retina PNG can easily hit 8-15 MB. Retina WebP keeps the sharpness at a fraction of the size.

Format + HTML to image: when rendering HTML templates as images (social cards, email headers, invoices), format choice depends on the output channel. WebP for web display, PNG for transparency, JPEG for email clients with limited format support.

Format + omit_background: transparent backgrounds only work with PNG and WebP. JPEG and AVIF don't support alpha channels. If you need a screenshot with a transparent background (for compositing or overlay purposes), use PNG or WebP.

Format + cookie blocking: clean screenshots without overlay banners compress better in lossy formats. Fewer visual elements with hard edges means JPEG and WebP produce smaller files with fewer artifacts.

The Puppeteer approach

With Puppeteer, format options are limited to PNG, JPEG, and WebP:

await page.screenshot({
  path: 'capture.webp',
  type: 'webp',
  quality: 80
});

No AVIF, no TIFF, and no quality control for PNG (it's always lossless). If you need AVIF or TIFF output from a self-hosted solution, you'd need to capture as PNG and then convert using a separate image processing library like Sharp — an extra dependency, extra processing time, and extra code to maintain. A screenshot API handles the encoding natively across all six formats — including screenshot API AVIF output that Puppeteer can't produce at all.

For a broader comparison of self-hosted vs managed approaches, see the Playwright vs screenshot API page.

Parameter reference

ParameterTypeDefaultRange / ValuesPlan
formatstringpngpng, jpeg, webp, avif, tiff, pdfAll (incl. Free)
qualityinteger801-100 (lossy formats only)All (incl. Free)

Both parameters are available on all plans including the free tier. No upgrade required to switch formats or adjust quality — whether you're generating thumbnails for a screenshot API workflow, feeding images to AI agents, or caching screenshots for faster delivery. Full API parameter reference in the documentation.

Frequently asked questions

screenshotrun supports six output formats: PNG (lossless, pixel-perfect), JPEG (small files, lossy), WebP (modern web standard, 25-35% smaller than JPEG), AVIF (maximum compression, newest format), TIFF (print and archival), and PDF (selectable text, clickable links). Set the format with a single parameter in your API request.
WebP at quality 80-90 is the best default for web display — it produces files 70-80% smaller than PNG with no visible quality loss. Use PNG when you need pixel-perfect accuracy (visual regression testing, legal evidence). Use JPEG for maximum compatibility with older systems. Use AVIF for the smallest possible files in modern applications.
The quality parameter accepts an integer from 1 (maximum compression) to 100 (minimum compression). It applies to lossy formats only — JPEG, WebP, and AVIF. PNG and TIFF are lossless and ignore this parameter. The default is 80, which produces sharp text with reasonable file sizes. Below 75, text starts to blur; above 90, file size savings over PNG become negligible.
Yes, use the omit_background parameter with PNG or WebP format. These two formats support alpha channels for transparency. JPEG and AVIF do not support transparency — if you set omit_background with these formats, the background renders as white instead of transparent.
Yes. Both format and quality parameters are available on all plans including the free tier. You can output screenshots in any of the six supported formats without upgrading. There are no format-specific restrictions or premium-only formats.