October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Capture Bulk Screenshots with a Fixed Viewport and Device Scale Factor

A practical Playwright workflow for bulk page screenshots with an explicit viewport, device scale factor, capture area, output scale, and per-page error handling.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For repeatable bulk screenshots, create one Playwright browser context with an explicit viewport width, height, and deviceScaleFactor, then open each URL in that context and save the capture. Decide separately whether each image should show only the viewport or the full page, and whether its output should use CSS pixels or device pixels. Those choices affect the captured area and output dimensions; they are not interchangeable.

Set one capture profile for the batch

A browser context gives the pages in a batch a shared emulation profile. Set the viewport and device scale factor when creating it rather than relying on browser defaults or changing settings implicitly between URLs. Playwright’s emulation documentation describes viewport and device scale factor options: Playwright: Emulation.

As an Amazon Associate I earn from qualifying purchases.

The viewport is the page’s visible browser area in CSS pixels. The device scale factor determines the relationship between CSS pixels and device pixels; it does not change the CSS viewport dimensions. For example, a 1280-by-800 CSS-pixel viewport with a factor of 2 can yield a 2560-by-1600 image when the screenshot uses device-pixel scale.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Capture a batch with Playwright

Install Playwright and its Chromium browser in your project, then save this as a JavaScript file. Supply URLs as command-line arguments, for example node capture.js https://example.com https://playwright.dev. The script creates a single browser and context, captures each URL in turn, and logs failures without stopping the remaining pages.

#1 Best Overall
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
const { chromium } = require('playwright');
const path = require('node:path');
const { createHash } = require('node:crypto');

const urls = process.argv.slice(2);
if (urls.length === 0) {
  console.error('Usage: node capture.js <url> [url ...]');
  process.exit(1);
}

function outputPathFor(url) {
  const hash = createHash('sha256').update(url).digest('hex').slice(0, 12);
  return path.resolve(`shot-${hash}.png`);
}

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext({
    viewport: { width: 1280, height: 800 },
    deviceScaleFactor: 2,
  });

  try {
    for (const url of urls) {
      const page = await context.newPage();
      try {
        const response = await page.goto(url, {
          waitUntil: 'networkidle',
          timeout: 30000,
        });
        if (response && !response.ok()) {
          console.error(`${url}: HTTP ${response.status()}`);
          continue;
        }
        await page.screenshot({
          path: outputPathFor(url),
          fullPage: false,
          scale: 'device',
          type: 'png',
        });
        console.log(`${url}: saved`);
      } catch (error) {
        console.error(`${url}: ${error.message}`);
      } finally {
        await page.close();
      }
    }
  } finally {
    await context.close();
    await browser.close();
  }
})();

The example chooses a 1280-by-800 CSS-pixel viewport, device scale factor 2, visible-viewport capture, and device-pixel output. Change those values together only when you intend to change the capture profile. The URL hash in each filename avoids collisions when different URLs have the same page title.

Install and run

  1. Install Playwright in a project: npm install playwright.
  2. Install its Chromium browser if it is not already available: npx playwright install chromium.
  3. Save the script as capture.js and run it with one or more URLs as shown above.

Choose the capture area and output scale

Playwright’s screenshot API documents the fullPage and scale options: Playwright: Page screenshot API.

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
Choice What it captures When to use it
fullPage: false The visible viewport at the configured dimensions. Use this for consistent above-the-fold comparisons or viewport-specific checks.
fullPage: true The full scrollable page, not just the configured viewport. Use this when the deliverable needs the whole page. Resulting image dimensions vary with page length, so images are not all the same height.
scale: 'css' An image scaled to CSS-pixel dimensions. Use this when you want output dimensions to track the CSS viewport rather than device pixel density.
scale: 'device' An image scaled to device pixels. Use this when the output should preserve high-DPI detail. At high device scale, screenshots may be twice as large or larger in pixel dimensions, increasing file size and storage needs.

Set both the context’s deviceScaleFactor and the screenshot’s scale intentionally. The former configures emulation; the latter selects the screenshot’s pixel scale. A device scale factor of 2 alone does not mean every saved screenshot will have twice the CSS-pixel dimensions if the capture requests CSS scale.

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

Wait for the page state you actually need

waitUntil: 'networkidle' is one possible navigation wait, not a universal guarantee that a page is visually ready. Some sites keep network connections open, load images or data after navigation, animate content, or reveal sections only after interaction. The documented screenshot and emulation APIs do not prescribe a readiness policy for every site.

Rank #3
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.
  • If a known element indicates readiness, wait for that selector with Playwright’s locator or page wait APIs before capturing.
  • If a page needs a short settling period after a specific interaction, use a deliberate delay sparingly and document why it is needed.
  • For lazy-loaded images on a full-page capture, scroll through the page or otherwise trigger the site’s loading behavior before the screenshot, then verify that the content appeared.
  • Record the URL, status, output path, and error for each attempt. This makes it easier to identify partial batches and retry only failed pages.

Keep batch runs manageable

The sequential loop above favors simple failure isolation: one slow or broken URL does not prevent later URLs from being attempted. For larger batches, concurrency can reduce total run time, but each open page consumes resources and competing navigation or rendering can make results less predictable. Add a bounded worker pool rather than opening every page at once, and choose the limit based on the machine and sites involved; the cited API documentation does not define a universal throughput or concurrency value.

  • Use stable, collision-resistant output names, and keep a manifest mapping each URL to its result.
  • Set navigation timeouts and log per-page outcomes; retry transient failures only a limited number of times.
  • Reuse the browser and context for a consistent profile, while closing each page after its capture.
  • For reproducibility, keep the browser version, viewport, scale factor, screenshot options, and readiness rule with the batch configuration.

Use Chromium DevTools Protocol for lower-level control

If you need direct Chromium protocol control rather than Playwright’s higher-level page API, the Chrome DevTools Protocol exposes device metrics through Emulation.setDeviceMetricsOverride and image capture through Page.captureScreenshot. The metrics command includes width, height, and device scale factor; capture can return image data and can target a clip region. See the protocol references for Emulation.setDeviceMetricsOverride and Page.captureScreenshot.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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

This approach is Chromium-specific and lower-level than Playwright. The protocol links point to live “tot” documentation, so check that the commands and options match the Chromium version you deploy. Protocol screenshot data is base64-encoded when transported over JSON; decode it to bytes before writing the image file.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common batch problems

  • Images have unexpected dimensions: Check the CSS viewport, deviceScaleFactor, screenshot scale, and fullPage option. Full-page height reflects page content, not just the viewport.
  • Some pages time out at network idle: A site may keep network activity alive. Select a more appropriate navigation readiness condition or wait for a page-specific element; neither choice is guaranteed to fit every site.
  • Images are blank or incomplete: Confirm navigation succeeded and inspect the page’s readiness condition. Dynamic data, lazy images, consent overlays, and client-side rendering may require a site-specific wait or interaction.
  • Later URLs are not attempted: Keep error handling inside the per-URL loop, as in the example, and ensure browser/context cleanup remains in the outer finally.
  • Files overwrite each other: Use a stable unique naming scheme based on the URL or an explicit input identifier instead of a shared filename such as screenshot.png.
  • High-DPI files are too large: Use CSS scale if device-pixel detail is unnecessary, or reduce the viewport or device scale factor to suit the output requirements.

Or skip the browser setup

ScreenshotNeo offers a screenshot API and MCP server for developers. A GET request can return an image or PDF; its screenshot features include fixed viewport options, device presets, full-page capture, and bulk capture of up to 100 URLs per call. Cookie/consent banners are accepted and removed before capture, along with known newsletter popups and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf. See ScreenshotNeo and the 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

Free includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for free and capture 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 I use one context for pages that need different viewport sizes?

Yes. Keep the shared context for the common profile, then set an individual page’s viewport when a URL genuinely needs a different size. Playwright documents page-level viewport overrides in its emulation guide.

Does device scale factor change the page’s CSS layout width?

No. The viewport dimensions define the CSS-pixel layout area; device scale factor controls device-pixel density. Screenshot scale then determines whether output follows CSS or device pixels.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.