October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Set a Custom Viewport Size for HTML-to-Image Conversion

Set the browser viewport before navigation, then choose the screenshot scope and pixel scale separately. Hosted converters use their own size parameters and limits.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the browser viewport’s width and height before navigating to the page, then choose separately whether to capture the visible viewport, the full page, or a clipped region. For hosted converters, pass the provider’s documented width and height parameters: their defaults and limits are service-specific.

What viewport size changes

The viewport is the visible layout area the browser uses to render a page. Its width and height can change responsive breakpoints, so a page captured at 390 × 844 CSS pixels may look different from the same page captured at 1440 × 900. Viewport dimensions are not necessarily the final image’s pixel dimensions: capture scope and output scale are separate settings.

As an Amazon Associate I earn from qualifying purchases.

Set the viewport in a browser library

Set dimensions before navigation when practical. This lets the site render initially at the intended size rather than loading at one size and adapting after a resize.

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

Playwright

With the Playwright Page API, set the viewport and then navigate:

#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
import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();
await page.setViewportSize({ width: 1280, height: 800 });
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'page.png' });
await browser.close();

If you create pages through a browser context, you can set the viewport on the context instead; Playwright recommends this when setting the size for pages in that context. For example:

const context = await browser.newContext({ viewport: { width: 1280, height: 800 } });
const page = await context.newPage();
await page.goto('https://example.com');

Playwright advises setting the viewport before navigation: “A lot of websites don’t expect phones to change size, so you should set the viewport size before navigating to the page.” See the Playwright Page 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

Puppeteer

Set the viewport before loading the target page. The following example specifies a 1280 × 800 viewport and a device scale factor of 1:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800, deviceScaleFactor: 1 });
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.screenshot({ path: 'page.png' });
await browser.close();

Some mobile or touch-property changes can cause Puppeteer to reload a page, another reason to configure the intended settings before navigation. See the Puppeteer setViewport reference.

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.

Choose the capture area and output scale

Changing the viewport does not automatically mean the screenshot should be a full-page image. Select the capture scope that matches the output you need.

Goal Setting What it captures
Show only the visible area Default screenshot The page as displayed in the viewport
Include content below the fold Playwright: fullPage: true; Puppeteer: fullPage: true The full page beyond the visible viewport
Capture a specific region Use the screenshot API’s clip option The selected rectangular region; its coordinates and dimensions determine the crop

Playwright offers screenshot scale options: css produces one image pixel per CSS pixel, while device uses device pixels and can produce a larger image on high-DPI devices. Puppeteer’s screenshot API separates full-page capture from clipping; how capture beyond the viewport behaves depends on whether a clip is provided. Consult the Playwright Page API and Puppeteer screenshot reference for the exact options in the version you use.

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

Set dimensions with a hosted HTML-to-image service

A hosted renderer usually accepts dimensions on the API request rather than through a browser Page or context. Use that service’s own parameter names and documented limits. For example, HTML2IMG documents width and height as controlling viewport size, responsive behavior, and output dimensions when fullpage is not enabled. Its documentation lists 1440 × 900 as the defaults and a range of 1–5000 for each dimension; those values are specific to HTML2IMG, not universal browser standards. Check the provider’s current documentation before relying on them. See HTML2IMG parameter documentation.

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

Or skip the browser setup

ScreenshotNeo takes a URL in one GET request and returns a screenshot or PDF. The request below asks for a WebP image of a page; see the ScreenshotNeo documentation for parameters and available formats.

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Visit ScreenshotNeo for details, or sign up for 1,000 free screenshots a month with no card.

Troubleshoot unexpected dimensions or layout

  • The responsive layout looks wrong: Confirm the viewport was set before navigation and that width and height are the intended CSS-pixel values. Check whether the page is also using mobile or touch emulation.
  • The image is larger than expected: Check device scale factor or screenshot scale. Device-pixel output can have more pixels than the CSS viewport dimensions.
  • The image cuts off page content: A viewport screenshot shows only the visible area. Enable full-page capture if you need content below the fold.
  • The capture includes the wrong region: Review the clip rectangle and whether the API interprets its coordinates relative to the viewport.
  • The result changes after resizing: Some page behavior or mobile/touch configuration may trigger a reload. Configure the desired viewport and emulation settings before navigation.
  • A hosted service rejects a size: Check that provider’s current width and height bounds and parameter names; limits are not shared across services.

FAQ

Does setting a 1280 × 800 viewport guarantee a 1280 × 800 output image?

No. That depends on capture scope and scale. A full-page image can be taller, while device-pixel scaling can change output pixel dimensions.

Should I change the viewport after the page loads?

Usually set it first. Post-navigation changes may cause responsive reflow, and some mobile or touch changes can reload the page.

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.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.