To take a screenshot in a Next.js app, choose between a hosted screenshot API, a browser you run with Playwright or Puppeteer, and Next.js’s native image route. Use a hosted API when you need to capture arbitrary URLs without managing a browser; use browser automation when you need control over the browser and capture process; use ImageResponse when you are designing an Open Graph card from application data rather than capturing a rendered page.
Choose the right screenshot approach
| Approach | Best fit | What it captures | Main trade-off |
|---|---|---|---|
| Hosted screenshot API | Capturing a URL from a server-side Next.js route without packaging a browser. | A rendered web page, according to the provider’s API and options. | You depend on a provider’s API, terms, quotas, and pricing. Keep credentials server-side. |
| Playwright or Puppeteer | When you want to write and control the browser automation yourself. | A page, full page, selected locator or element, or a clipped region, depending on the library. | You must make the browser runtime work in your deployment environment. |
Next.js ImageResponse |
Creating a designed social image from route or application data. | A generated image, not a screenshot of an arbitrary rendered URL. | Its supported CSS is a subset of browser CSS; it is not a general-purpose browser. |
The term “screenshot API” can mean a provider’s hosted HTTP endpoint or a screenshot method in a browser automation library. The examples below distinguish the two. A vendor tutorial published by ScreenshotAPI on March 14, 2026 demonstrates that provider’s own SDK and Next.js examples; it is not a standard Next.js interface or independent validation of the service (ScreenshotAPI tutorial).
Capture a page with Playwright
Playwright’s screenshot guide demonstrates saving a viewport screenshot, capturing a full page, returning an image buffer, and taking a screenshot of a locator. The following calls assume you already have a Playwright page set up and navigated to the page you want. See the official Playwright screenshot guide for the current setup and version-specific details.
Viewport screenshot saved to disk
await page.screenshot({ path: 'screenshot.png' });
This saves the currently visible viewport. It does not, by default, extend the capture to the entire document.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Full-page screenshot
await page.screenshot({ path: 'screenshot.png', fullPage: true });
Use fullPage: true when the output should include content beyond the current viewport. Pages with lazy-loaded images or content that appears only after scrolling may need additional handling; inspect the saved image to confirm the page rendered as intended.
Return an image buffer or capture one element
const imageBuffer = await page.screenshot();
await page.locator('.header').screenshot({ path: 'header.png' });
The buffer form is useful when the Next.js route needs to send image bytes rather than save a file. Locator screenshots are useful for a component or region, provided the locator resolves to the intended element.
Capture a page with Puppeteer
Puppeteer’s guide shows a browser launch, navigation, page screenshot, and browser close. This example writes a viewport screenshot to a file; it uses the guide’s sample destination. Check the Puppeteer screenshot guide and the ScreenshotOptions documentation for current setup and option details.
const browser = await puppeteer.launch();
const page = await browser.newPage();
try {
await page.goto('https://news.ycombinator.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'hn.png' });
} finally {
await browser.close();
}
The try/finally ensures the browser is closed if navigation or capture throws an error. In an application route, do not leave browser processes running between requests unintentionally; manage their lifecycle according to your deployment model.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Full page, element, clip, and output format
Puppeteer documents options including fullPage, clip, path, type, quality, and omitBackground. It also documents element screenshots. For example, an element capture follows this pattern:
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
const element = await page.$('.header');
if (!element) throw new Error('Header element not found');
await element.screenshot({ path: 'header.png' });
Use clip when you need a defined region rather than the full page or an element. omitBackground can preserve transparency where supported. Puppeteer’s options documentation specifies that quality applies to JPEG and WebP, not PNG.
Return a screenshot from a Next.js route
In a Next.js application, put browser automation or a hosted API call in server-side code, such as a Route Handler, rather than exposing a provider secret to client-side JavaScript. The route should return image bytes with an appropriate content type. Keep the provider’s key in a server-only environment variable and validate any user-supplied URL before requesting a capture; otherwise, an endpoint that accepts arbitrary URLs can become a way to make your server request unintended destinations.
The exact route code depends on the API provider’s SDK or HTTP contract and on the Next.js version and runtime you deploy. ScreenshotAPI’s tutorial demonstrates its own Node SDK in route handlers, including generated Open Graph images and link previews. Treat that as a provider-specific implementation: confirm its current SDK, credentials guidance, quotas, and pricing in its own documentation before adopting it (ScreenshotAPI’s tutorial).
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Route design checklist
- Accept only the parameters your application needs, such as a page URL and image format.
- Validate and, where appropriate, allowlist destination hosts. Do not blindly proxy arbitrary user-provided URLs.
- Read API credentials on the server. Never place a secret key in a client component or public environment variable.
- Return the correct image content type and status code, and handle upstream errors deliberately.
- Set limits appropriate to your application for request duration, output size, and concurrent work.
- Check the selected Next.js runtime and hosting platform for browser or network restrictions before deployment.
Use Next.js ImageResponse for social cards
If the goal is a social preview image built from a title, author, or other application data, a browser screenshot may be unnecessary. Next.js documents an opengraph-image.tsx file convention and an ImageResponse renderer. For example, a route can live at app/blog/[slug]/opengraph-image.tsx and render a card from that post’s data. Follow the Next.js metadata and OG image guide for the current exports and implementation.
ImageResponse supports a subset of CSS, including common flexbox layouts in the documented guide, but not every browser layout feature; the guide identifies CSS Grid as unsupported in its example. Choose it for a designed image from data, not when you need a screenshot of an arbitrary website as rendered in a full browser.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Deploying Puppeteer with Next.js on Vercel
Browser deployment is host-specific. Vercel’s knowledge-base guide for Puppeteer with Next.js describes using puppeteer-core with @sparticuz/chromium-min, rather than bundling the standard puppeteer package, because of the function bundle-size limit cited in that guide. The article states a 250 MB limit, but that is a platform constraint reported by the guide, not a universal or timeless limit. Check Vercel’s current runtime, bundle limit, architecture compatibility, and package instructions before using its example (Vercel Knowledge Base: Deploying Puppeteer with Next.js on Vercel, updated November 10, 2025 according to the guide’s search listing).
For any host, verify these items before choosing self-managed browser automation:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems- Whether the runtime supports launching the required browser binary and its dependencies.
- Whether the deployment package and function limits accommodate the browser configuration.
- Whether the function’s execution time and memory are sufficient for navigation and capture.
- Whether concurrent requests could exceed the capacity of your deployment.
- Whether the capture needs authenticated cookies, headers, or other sensitive context, and how that data is protected.
Choose capture options by output need
| Need | Suitable pattern | Things to check |
|---|---|---|
| Visible screen only | Default page screenshot in Playwright or Puppeteer. | Viewport dimensions and whether the page has finished rendering. |
| Entire document | Playwright fullPage: true or Puppeteer’s full-page option. |
Lazy content, very long pages, and whether the browser has loaded all relevant assets. |
| One component | Playwright locator screenshot or Puppeteer element screenshot. | Selector uniqueness, element visibility, and layout stability. |
| Defined rectangular area | Puppeteer’s clip option. |
Coordinates and dimensions relative to the rendered page. |
| Social card designed from data | Next.js ImageResponse. |
Supported CSS subset and the desired card dimensions. |
For a hosted screenshot service, consult its own API documentation for supported capture extent, output format, viewport, and waiting behavior. Those features and parameter names are provider-specific; do not assume browser-library options map directly to a hosted service.
Performance, reliability, and cost considerations
The available product documentation establishes implementation patterns, not a comparative benchmark. It does not establish that a hosted service or a self-managed browser is universally faster, cheaper, or more reliable. Compare the choices against your own request volume, deployment constraints, output requirements, and tolerance for operating a browser runtime.
- Hosted API: Less browser setup in your application, but a provider becomes an external dependency. Review its current quotas, terms, and pricing and decide how your route will handle timeouts or upstream failures.
- Self-managed browser: More control over automation and browser options, while your team takes responsibility for browser packaging, runtime compatibility, lifecycle, and capacity.
- ImageResponse: Avoids capturing a live page when the requirement is a designed social image, but its CSS support does not match a full browser.
- Request handling: Use bounded waits and explicit failure handling. A screenshot request can take longer than an ordinary data lookup because it requires page rendering; ensure your host’s limits fit the work.
- Output size: Select viewport or full-page capture and image format based on what the consumer needs. Larger captures produce more data to transmit and store.
Troubleshooting common failures
The route works locally but fails after deployment
Likely cause: The deployed function cannot find or launch the browser binary, or the runtime and package combination is incompatible. Fix: Check the host’s current deployment limits and browser-runtime requirements. For Vercel, start with its current Puppeteer deployment guide rather than assuming a local Chromium installation will be available.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
The screenshot is blank or missing content
Likely cause: Navigation completed before the page’s relevant content rendered, or the target site presented a consent prompt, bot check, or other interstitial. Fix: Inspect the loaded page and choose an appropriate wait condition or explicit selector wait. Do not assume that a navigation event guarantees that all page content is ready.
A full-page capture omits images or below-the-fold content
Likely cause: The page loads some content lazily as it enters the viewport. Fix: Use the library’s full-page behavior, then verify whether the page requires scrolling or another application-specific readiness step before capture.
An element screenshot fails
Likely cause: The selector did not match, matched the wrong element, or resolved before the element was visible. Fix: Check the selector against the rendered page, wait for the intended element, and handle a missing match explicitly.
PNG ignores a requested quality value
Likely cause: Puppeteer’s documented quality option applies to JPEG and WebP, not PNG. Fix: Choose JPEG or WebP if a lossy quality setting is required, or keep PNG when that format is needed.
A third-party API call fails from the route
Likely cause: Invalid credentials, provider-specific parameter names, quota or billing limits, a timeout, or an upstream error. Fix: Check the provider’s response and current documentation, keep the key server-side, and return a deliberate error response instead of silently serving invalid image bytes.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Or skip the browser setup
ScreenshotNeo is a hosted website screenshot API and MCP server for developers. Its API accepts one GET request for a URL and can return PNG, JPEG, WebP, or PDF. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with X-Page-Verdict and X-Billed response headers indicating the outcome. See the ScreenshotNeo site and API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Keep YOUR_API_KEY on the server; do not put it in browser code. ScreenshotNeo also supports custom CSS and JavaScript, full-page capture, element capture by CSS selector, viewport and device options, PDF settings, waiting controls, request blocking, custom headers and cookies, caching, signed public image links, asynchronous jobs, bulk capture, and a usage API. Its parameter names also work with those used by other screenshot APIs to make migration easier.
ScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan, and annual billing gives two months free. Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Can a Next.js Route Handler return a screenshot as an image?
Yes. A server-side route can return image bytes with the appropriate content type, whether those bytes come from browser automation or a hosted screenshot API.
Should I use ImageResponse to screenshot another website?
No. ImageResponse generates an image from your own layout and data; use a browser or screenshot service to capture an already rendered website.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

