ScreenshotNeo

BlogHow-to

ScreenshotAPI.net for Social Media Preview Images: Setup and Sizing

Set up ScreenshotAPI.net to generate social preview images, choose a practical image size, and publish the right Open Graph metadata.

By the ScreenshotNeo team4 October 20267 min read

For a practical starting point, create a 1200 × 630 pixel image, publish its absolute public URL in og:image, and declare its width and height. ScreenshotAPI.net documents two ways to make one: capture an existing page by URL, or render custom HTML for a consistent branded card. For LinkedIn, its Help page specifies a minimum of 1200 × 627 pixels, a recommended 1.91:1 ratio, JPG, PNG, or GIF, and a maximum file size of 5 MB. These are LinkedIn requirements, not universal limits for every social platform. LinkedIn image requirements

1. Choose what the preview should show

Use URL capture when the page itself should appear in the preview. Use custom HTML when you want a repeatable card design with page-specific title, author, or category. ScreenshotAPI.net documents both approaches; these examples describe its workflow and are not independent performance tests. ScreenshotAPI.net features

  • Existing page: capture the page URL. This is convenient, but the result depends on the page’s current layout and loading behavior.
  • Designed card: render HTML with the content and styling you want. This gives you direct control of the composition and makes a shared template practical across many pages.

2. Make the image with ScreenshotAPI.net

Get an API key from the ScreenshotAPI.net dashboard, then use its documented endpoint and parameters. Confirm the current request format and authentication details in the ScreenshotAPI.net documentation before putting the request into production.

Capture an existing page with cURL

curl -G "https://shot.screenshotapi.net/screenshot" \
  --data-urlencode "token=YOUR_API_KEY" \
  --data-urlencode "url=https://example.com/article" \
  --data-urlencode "width=1200" \
  --data-urlencode "height=630" \
  --data-urlencode "output=image" \
  --data-urlencode "file_type=png" \
  -o article-preview.png

This illustrates the vendor’s documented URL-capture pattern. Check the current API reference for exact parameter names and supported output settings for your account.

Render a branded card from custom HTML

The feature material shows a POST body using custom_html, dimensions, and file_type. A request can be structured like this; verify the endpoint and any required headers against the current API docs.

curl -X POST "https://shot.screenshotapi.net/screenshot" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "YOUR_API_KEY",
    "custom_html": "<main style=\"width:1200px;height:630px;padding:72px;background:#101827;color:white;font:48px Arial\"><h1>Article title</h1><p>A concise description</p></main>",
    "width": 1200,
    "height": 630,
    "file_type": "png"
  }' \
  -o article-preview.png

Keep the card’s content within the canvas, use a font available to the renderer or load it explicitly, and check the resulting image before publishing. The vendor’s HTML-to-image guide lists PNG, JPG, WebP, and PDF output; that list does not mean every social platform accepts every type. HTML to image guide

3. Publish Open Graph metadata

Host the generated file at a stable, publicly reachable HTTPS URL. Add its absolute URL to og:image and declare the pixel dimensions. The Open Graph protocol defines the width and height properties; LinkedIn’s example also includes title, description, and page URL metadata. Open Graph protocol LinkedIn Help

<meta property="og:title" content="Article title">
<meta property="og:description" content="A concise description of the article.">
<meta property="og:url" content="https://example.com/article">
<meta property="og:image" content="https://cdn.example.com/og/article.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://cdn.example.com/og/article.png">

The Twitter card tags above follow ScreenshotAPI.net’s example. This guide has not verified current X platform requirements, so treat them as a vendor example rather than a confirmed current requirement.

4. Size and format choices

Use case Guidance Check
General starting canvas in ScreenshotAPI.net’s example 1200 × 630 pixels Confirm destination platform guidance if its requirements matter.
LinkedIn At least 1200 × 627; recommended ratio 1.91:1 Keep the file at or below 5 MB; use JPG, PNG, or GIF.
URL screenshot Use when a capture of the page is the desired preview. Check the page after rendering for delayed content or overlays.
Custom HTML Use for a repeatable branded image with variable page content. Check fonts, asset loading, and text fit.
Image format Choose a format supported by the destination. The API’s available formats and a platform’s accepted formats are separate questions.

A 1200 × 630 image exceeds LinkedIn’s stated minimum dimensions and is close to its recommended ratio. Leave visual breathing room around essential content because displayed crops can vary; the cited LinkedIn guidance does not establish a universal safe-zone measurement. The research for this article did not verify current specifications for Facebook, X, Slack, WhatsApp, or other destinations, so check each platform’s official documentation before relying on exact limits.

5. Keep previews current

ScreenshotAPI.net documents caching and a fresh=true option to request a current screenshot when a previous result is cached. Its feature material describes refreshing a cached image after page content changes. For generated cards, use a deliberate refresh policy: regenerate when the title, artwork, or other content changes, and keep the published image URL stable only if your hosting and cache behavior will serve the new bytes as intended. Review the current vendor documentation for the behavior that applies to your account. ScreenshotAPI.net caching features

6. Troubleshooting

Symptom Likely cause What to do
Preview image is missing The image URL is relative, private, or inaccessible to the platform’s crawler. Use an absolute HTTPS URL and confirm it is publicly reachable without a login or expiring access token.
Old image keeps appearing A generated image or preview is cached. Request a fresh capture with the documented fresh=true option where applicable, then check the image host and platform preview cache.
Image is cropped unexpectedly The receiving platform displays a crop or ratio different from the original canvas. Keep important content away from the edges and inspect the share preview on the destination platform.
Text or images are absent in a URL capture Page content may load after the capture, require interaction, or be blocked. Prefer custom HTML for a stable card, or use the API’s documented wait controls if available for your request.
Custom card uses fallback fonts The desired font was not available when HTML rendered. Load the font as a reachable asset or use a dependable fallback, then regenerate and inspect the result.
LinkedIn does not accept the image The file may exceed 5 MB, use an unsupported format, or be below the stated dimensions. Use JPG, PNG, or GIF, meet the minimum 1200 × 627 dimensions, and stay within 5 MB.
API returns an error Credentials, URL encoding, request shape, or an unsupported option may be wrong. Check the API key, encode the target URL, compare parameters with the current API reference, and inspect the response before saving it as an image.

7. Performance, reliability, and cost considerations

  • Keep the render path light: custom cards with few external assets have fewer dependencies than capturing a page with many scripts and images. This is an implementation consideration, not a measured ScreenshotAPI.net benchmark.
  • Use caching deliberately: cache stable previews to avoid regenerating them on every share or page view, and refresh when the underlying content changes.
  • Validate before publishing: check dimensions, format, file size, image accessibility, and metadata on a representative page.
  • Budget from current vendor pricing: this research dossier does not establish ScreenshotAPI.net pricing or a cost estimate. Check the vendor’s current plan terms and expected request volume before choosing an implementation.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. Its API can return a screenshot or PDF with one GET request, and its options include full-page capture, custom CSS and JavaScript, image resizing, caching, and signed links for public image tags. Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed, and responses include page-verdict and billing headers. Its MCP server gives AI agents tools to take screenshots, get page info, and capture PDFs. One thousand screenshots a month are free with no card; paid plans start at $5 for 3,000. See the ScreenshotNeo API docs.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/article -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/article"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/article' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`ScreenshotNeo returned ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
await (await import('node:fs/promises')).writeFile('shot.webp', image);

Start with ScreenshotNeo: sign up for 1,000 free screenshots a month with no card.

FAQ

Is 1200 × 630 the right size for LinkedIn?

It meets LinkedIn’s documented minimum dimensions of 1200 × 627 and is close to the recommended 1.91:1 ratio. The image must also meet LinkedIn’s format and 5 MB limit.

Should I use a screenshot or custom HTML?

Capture a URL when the page itself is the preview. Render HTML when you need a consistent, branded card whose content varies by page.

Does one image size guarantee the same result on every social platform?

No. The dossier verifies LinkedIn’s requirements and the vendor’s 1200 × 630 example, but not a current cross-platform specification matrix. Check each destination’s official guidance.

Can I use WebP for a social preview?

The vendor’s HTML-to-image guide lists WebP output, but that does not establish that every receiving platform accepts it. For LinkedIn, use one of its documented formats: JPG, PNG, or GIF.