Webpage to Image API: Convert URLs to PNG & JPEG

Turn any URL into a pixel-perfect image with a single HTTP GET request. Full-page screenshots, custom viewports, retina 2x resolution, and automatic ad and cookie blocking included.

Start Free — 200 captures/moView Docs

Convert a Webpage to Image in One API Call

Converting a URL to an image is a single GET request. Pass your target URL and API key, and receive a JPEG or PNG binary response:

curl "https://api.snapapi.pics/v1/screenshot?url=https://example.com&format=jpeg&full_page=true" \
  -H "X-Api-Key: YOUR_API_KEY" \
  --output screenshot.jpg

The response body is raw binary image data — a standard JPEG or PNG you can stream directly to a file, upload to S3, or return in an HTTP response. No base64 decoding, no JSON unwrapping, no post-processing required.

Key Parameters for Webpage to Image Conversion

SnapAPI supports more than 40 parameters for controlling the output image. The most commonly used parameters are described below.

format accepts jpeg (default), png, or webp. JPEG produces smaller files for photographs; PNG preserves transparency for UI screenshots; WebP balances both size and quality. full_page set to true captures the entire scrollable page height, not just the visible viewport. This is essential for content-heavy landing pages and documentation sites. width and height control the browser viewport size in pixels — default is 1280 by 800. Use 375 by 812 for mobile screenshots. device_scale_factor set to 2 produces retina-quality output at double pixel density, matching what users see on high-DPI displays.

block_ads removes ad network scripts and trackers before capturing, producing cleaner images without banners or overlays. block_cookies automatically dismisses cookie consent banners so they do not appear in the captured image. delay waits a specified number of milliseconds after page load before capturing — useful for animated content, carousels, or charts that animate on entry. wait_for waits until a CSS selector is present in the DOM before capturing, ensuring dynamically rendered content is fully visible.

Device Emulation for Mobile and Tablet Screenshots

Pass a device parameter to emulate any of 30 or more real device profiles: iPhone 15 Pro, Samsung Galaxy S24, iPad Pro, MacBook Pro Retina, and more. Device emulation sets the correct viewport dimensions, pixel density, user agent string, and touch capabilities in one step, producing images that match exactly what real users see on those devices.

Webpage to Image API Use Cases

Converting web pages to images unlocks a range of product features and automation workflows that are difficult or impossible to build with traditional server-side HTML rendering libraries.

Open Graph Image Generation

Dynamic OG images dramatically improve click-through rates when content is shared on social media platforms. Instead of a generic brand logo, each article or product page shows a customized preview image generated from an HTML template populated with that page's specific data. With SnapAPI, you build the template as a standard HTML page, inject the content server-side, capture via the API, and store the resulting image in your CDN. The whole pipeline takes under a second per image once warmed up, and the resulting images render correctly on Twitter, LinkedIn, Slack, and iMessage previews.

Visual Regression Testing in CI/CD

Capture screenshots of key pages before and after a deploy, then run a pixel diff to detect unexpected visual regressions. SnapAPI integrates directly into CI/CD pipelines — call the API from a GitHub Actions workflow, compare the images using a library like Pixelmatch or Resemble.js, and fail the build if the diff percentage exceeds a configured threshold. This catches CSS bugs that unit tests miss, including font rendering issues, layout shifts caused by new dependencies, and broken dark mode implementations.

Thumbnail Generation for CMS and Link Preview Services

Content management platforms, link preview services, read-later apps, and bookmark managers need a thumbnail for every URL in their database. SnapAPI handles the rendering queue — you fire-and-forget capture requests, and the API returns images that can be stored alongside content records. Thumbnails update automatically when you re-capture the same URL on a schedule.

Compliance and Audit Archiving

Financial services, legal, and healthcare teams capture timestamped screenshots of web interfaces as part of audit trails and compliance documentation requirements. SnapAPI supports custom HTTP headers, cookies, and authentication tokens, enabling capture of pages that require an active user session. The resulting images carry full pixel fidelity and can be embedded in compliance reports or uploaded to document management systems alongside metadata.

Integrating the Webpage to Image API in Any Language

Because the API is a simple HTTPS endpoint, any language that can make an HTTP GET request works out of the box. Official SDKs are available for JavaScript, Python, Go, PHP, Swift, Kotlin, Ruby, and C# to simplify integration further. The Node.js example below demonstrates the full request-response cycle including error handling:

const https = require('https');
const fs = require('fs');

function webpageToImage(url, apiKey, outputPath) {
  return new Promise((resolve, reject) => {
    const params = new URLSearchParams({
      url, format: 'jpeg', full_page: 'true',
      block_ads: 'true', block_cookies: 'true'
    });
    const options = {
      hostname: 'api.snapapi.pics',
      path: '/v1/screenshot?' + params,
      headers: { 'X-Api-Key': apiKey }
    };
    https.get(options, res => {
      if (res.statusCode !== 200) return reject(new Error(`Status ${res.statusCode}`));
      const dest = fs.createWriteStream(outputPath);
      res.pipe(dest);
      dest.on('finish', resolve);
    }).on('error', reject);
  });
}

webpageToImage('https://example.com', process.env.SNAPAPI_KEY, 'output.jpg')
  .then(() => console.log('Saved output.jpg'))
  .catch(console.error);

The response is streamed directly to disk, avoiding buffering the entire image in memory. For large full-page captures this approach is significantly more efficient than accumulating chunks in an array before writing.

Start capturing webpages as images at snapapi.pics — 200 free captures per month, no credit card required. The free tier supports all output formats, device emulation, and capture parameters, giving you the complete feature set to evaluate the API against your use case before committing to a paid plan.

Authenticated Page Capture and Custom Headers

Many valuable pages require authentication: user dashboards, admin panels, analytics reports, account statements, and SaaS application views. SnapAPI supports authenticated capture by forwarding custom HTTP headers and cookies to the target page. Pass session cookies in the cookies parameter and custom request headers in headers:

curl -X POST "https://api.snapapi.pics/v1/screenshot" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://app.example.com/dashboard",
    "cookies": "session=abc123; csrf_token=xyz789",
    "headers": { "X-Internal-Token": "my-service-token" },
    "full_page": true,
    "format": "png"
  }' \
  --output dashboard.png

Cookie strings use the standard name=value; name2=value2 format — the same format your browser sends in the Cookie header. For JWT-protected apps, pass the token in a custom Authorization header instead.

Custom CSS and JavaScript Injection

SnapAPI lets you inject custom CSS and JavaScript before capturing. Use this to hide UI elements that should not appear in the output — navigation bars, floating chat widgets, cookie banners that the block_cookies parameter does not catch, or development environment banners. Pass a CSS string in the custom_css parameter:

{
  "url": "https://example.com",
  "custom_css": ".nav, .cookie-banner, .chat-widget { display: none !important; }",
  "custom_js": "document.querySelector('.modal')?.remove()",
  "full_page": true
}

JavaScript injection runs after page load, making it possible to interact with the page before capture: clicking buttons to reveal hidden content, scrolling to a specific section, or triggering animations to a specific frame.

Pricing and Rate Limits

SnapAPI pricing is based on capture volume with no per-feature charges. Every plan includes access to all API endpoints: screenshot, scrape, extract, PDF, video, and AI analysis. The free tier provides 200 captures per month with no credit card required — enough to evaluate the API and build a prototype integration.

Paid plans start at $19 per month for 5,000 captures on the Starter tier. The Pro plan at $79 per month covers 50,000 captures per month and includes higher concurrency limits for batch workloads. The Business plan at $299 per month provides 500,000 captures and is designed for teams running high-volume pipelines such as daily product catalogue monitoring, real-time OG image generation, or enterprise visual regression suites.

Rate limit headers are returned on every response: X-RateLimit-Remaining indicates your remaining monthly quota, and Retry-After specifies how many seconds to wait after a 429 response. Reading these headers in your integration prevents unexpected throttling on batch jobs.

Register at snapapi.pics to get your API key and start capturing webpage images. The full API reference with every parameter, response format, and code example is available at snapapi.pics/docs.html. SDKs for JavaScript, Python, Go, PHP, Swift, Kotlin, Ruby, and C# are all available on GitHub under the Sleywill organization.

webpage url convert image api png jpeg