What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Puppeteer’s page.screenshot() to capture the page, then send its bytes from your Express route with the matching image content type. Puppeteer returns binary screenshot data by default; converting it to a Node.js Buffer and setting the response type makes the image usable by browsers and API clients.

Return a Puppeteer screenshot from an Express route

This ES module example launches Chromium for the request, navigates to a fixed page, captures a PNG, and returns the image bytes. It closes the browser even if navigation or capture fails.

import express from 'express';
import puppeteer from 'puppeteer';

const app = express();

app.get('/screenshot', async (req, res, next) => {
  let browser;
  try {
    browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });

    const image = await page.screenshot({ type: 'png' });
    res.type('png').send(Buffer.from(image));
  } catch (error) {
    next(error);
  } finally {
    await browser?.close();
  }
});

app.listen(3000);

Install express and puppeteer in your project before running the example. The route uses a fixed target URL deliberately; accepting an arbitrary URL from a caller requires additional security controls.

Why the response needs a content type

Puppeteer’s screenshot API returns a Uint8Array in binary mode by default, with PNG as the default format. Buffer.from(image) converts those bytes to a Node.js Buffer. Express can send a Buffer directly, but defaults its Content-Type to application/octet-stream unless a type was set. res.type('png') sets image/png before the bytes are sent. See the Puppeteer screenshot API and Express 4.x response API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Choose capture format, area, and readiness

PNG, JPEG, or WebP

Keep the screenshot format and HTTP content type aligned. PNG is the default and supports transparent backgrounds when requested. If you select JPEG, return image/jpeg; use the corresponding type for WebP where supported by your Puppeteer version.

const image = await page.screenshot({ type: 'jpeg', quality: 80 });
res.type('jpeg').send(Buffer.from(image));

Quality is relevant to lossy formats such as JPEG. Choose based on whether the image needs transparency, crisp text, or a smaller response; there is no universally best format.

Viewport, full page, or a clipped region

The default capture covers the current viewport. Set fullPage: true to capture the full page, or pass a clip rectangle to capture a defined region. Set omitBackground: true when a transparent background is needed and the chosen format supports it.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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 image = await page.screenshot({
  type: 'png',
  fullPage: true,
  omitBackground: true
});

These options are documented in the Puppeteer screenshot options. A full-page image can be much larger than a viewport capture, so use it only when the client needs the whole document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wait for the page you actually need

networkidle2 is an example navigation condition, not a guarantee that every application has finished rendering. Pages with ongoing network requests, client-side rendering, or delayed content may need a different readiness condition. When the application exposes a stable element, wait for it explicitly:

await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('#report-ready');

Puppeteer’s guide demonstrates navigation and screenshot capture, but the correct wait condition depends on the target page. See the Puppeteer screenshot guide.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Send a saved screenshot instead of in-memory bytes

For a screenshot generated and returned in the same request, use res.send() as in the route above. If you instead save an image to disk and serve it later, Express provides res.sendFile(). Do not build an unrestricted file path from caller input; constrain file serving to an intended directory. For a directory of known static images, use express.static(). See the Express sendFile API and Express static middleware.

Production considerations: lifecycle, errors, and load

Browser lifecycle

Launching a browser for every request keeps the example self-contained, but can be costly at higher request volumes. A production service may reuse a managed browser process while creating an isolated page or context per request. Whatever model you use, ensure pages and browser resources are released after failures as well as successful captures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Errors after a response begins

Passing an error to next(error) lets Express handle failures before the image response is sent. If an error occurs after headers or response data have already been sent, avoid attempting to send a second response; Express exposes res.headersSent for checking response state. The browser cleanup belongs in a finally block so it runs after navigation or screenshot exceptions.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

Request URLs and service limits

If the endpoint accepts a URL from a request parameter, treat that input as untrusted. The example does not define authentication, URL restrictions, timeouts, concurrency limits, or caching. Those are application-specific requirements, and the cited API mechanics do not by themselves make an endpoint safe or production-ready. Also adapt imports, runtime dependencies, and browser process management to the Puppeteer and Express versions used by your application; the Express response reference here is for 4.x.

Common problems and fixes

  • The client downloads an unknown binary file: Set the matching type before sending the Buffer, such as res.type('png') for PNG.
  • The response claims to be PNG but the image is not PNG: Make the screenshot type and response content type agree.
  • The screenshot is blank or misses content: The page may not be ready at the selected navigation event. Wait for a page-specific selector or other readiness condition before capturing.
  • The route fails on long or active pages: Review navigation readiness and configure suitable request and application timeouts; no single wait condition suits every site.
  • Browser processes accumulate after errors: Close the browser in finally, and ensure your production lifecycle also releases pages or contexts.
  • Serving an image saved to disk exposes unintended files: Do not use an unconstrained user-controlled path with res.sendFile(); restrict it to a known root or use static middleware for a fixed asset directory.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a screenshot API and MCP server for developers. Its one-call endpoint returns an image or PDF; the request below captures a PNG response and saves it as a file. See the ScreenshotNeo API documentation for request options.

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

ScreenshotNeo can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.

Frequently Asked Questions

Can an Express endpoint return an image directly in the response?

Yes. Send the screenshot bytes with res.send() and set the corresponding image content type first.

Does Puppeteer return a Buffer from page.screenshot()?

The current API documents a Uint8Array for binary output. Buffer.from(image) converts it for Express response handling.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.