Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Set the Viewport Size in an HTMLCSStoImage Request

Set both viewport_width and viewport_height in an HTMLCSStoImage request to control its responsive layout. Learn how mobile emulation and output scaling differ.

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.

Set both viewport_width and viewport_height in the create-image request. For example, 1200 by 630 gives Chrome a 1200 × 630 CSS-pixel viewport, which controls responsive layout; it does not necessarily produce an image with those exact pixel dimensions. HTML/CSS to Image’s viewport documentation requires the two fields together.

Set both viewport dimensions in the request

The create-image endpoint is POST https://hcti.io/v1/image. Send either a url or html field—not both—and include the viewport dimensions as additional request parameters. JSON and form data are supported.

As an Amazon Associate I earn from qualifying purchases.

JSON request body

{
  "url": "https://example.com",
  "viewport_width": 1200,
  "viewport_height": 630
}

cURL with form-style parameters

curl -X POST https://hcti.io/v1/image 
  -u YOUR_USER_ID:YOUR_API_KEY 
  -d url=https://example.com 
  -d viewport_width=1200 
  -d viewport_height=630

The viewport fields are integers measured in CSS pixels. The documented maximum viewport width is 6000. When you omit both fields, the documentation says Chrome uses a 1920 × 1080 viewport. See the API usage reference for request requirements and authentication details.

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

Choose dimensions for the layout you want

Viewport width affects which CSS media queries and responsive styles apply. Use dimensions matching the target breakpoint: a desktop layout, tablet layout, and narrow mobile layout may render different content even when the underlying page URL is identical. Set both dimensions for every intended viewport; the API documentation states that both are required when setting either one.

#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

For example, a request using viewport_width: 390 and viewport_height: 844 establishes a mobile-sized CSS viewport. The height sets the initial visible area; it does not by itself make the page behave like a mobile device.

Render mobile, landscape, or touch behavior

For mobile viewport behavior, add viewport_mobile: true alongside the dimension pair. HTML/CSS to Image says this enables Chrome mobile viewport behavior, including support for the page’s <meta name="viewport"> settings.

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

viewport_landscape and viewport_touch are optional booleans, both defaulting to false. They can be enabled when the page depends on those device characteristics, but neither changes the viewport dimensions. A mobile-oriented request can therefore look like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "url": "https://example.com",
  "viewport_width": 390,
  "viewport_height": 844,
  "viewport_mobile": true,
  "viewport_touch": true
}

Viewport size is not the same as image resolution or capture bounds

Viewport dimensions control the browser’s virtual CSS area and responsive layout. Other parameters control how much content is captured or how many output pixels are generated.

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.
  • Output resolution: device_scale changes image resolution without changing the CSS viewport. The API documents a range of 0.1 to 3. The FAQ says rendering is 2× by default; set device_scale: 1 for 1× output. See the HTML/CSS to Image FAQ.
  • Capture below the initial viewport: full_screen captures the full page for URL screenshots.
  • Crop to one element: selector crops the result to an element inside the configured viewport.
  • Resize after generation: the generated-image URL’s width and height query parameters can resize the image without changing the viewport or rerendering the page.

These controls solve different problems. If the layout breakpoint is wrong, adjust the viewport pair. If the layout is right but the image has too many or too few pixels, adjust device_scale or resize the generated image. Use full-page capture or selector cropping only when the desired capture bounds differ from the initial viewport.

Why is my image twice as large as expected?

The FAQ identifies 2× as the default rendering scale. That can make output pixel dimensions larger than the CSS viewport dimensions. Set device_scale: 1 when you need 1× output; leave the viewport pair set to the dimensions needed for layout. Do not reduce viewport width just to compensate for high-resolution output, because that can trigger different responsive styles.

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

Troubleshooting viewport requests

  • Only one dimension was sent: include both viewport_width and viewport_height. The documentation requires the pair.
  • The page uses the desktop layout at a mobile width: add viewport_mobile: true; dimensions alone do not enable mobile viewport behavior.
  • The result has different responsive styling than expected: check the CSS-pixel width against the page’s media-query breakpoint, then capture again using the intended pair.
  • The output pixel dimensions exceed the viewport dimensions: check device_scale, which affects output resolution independently of layout size.
  • Content below the first screen is missing: for URL screenshots, use full_screen if the goal is a full-page capture.
  • The image includes too much of the page around a component: use selector to crop to the element rather than changing the viewport breakpoint.
  • The request is rejected or lacks a page to render: verify that the request supplies exactly one of url or html, along with the required authentication and other request fields.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot endpoint rather than configuring a rendering request yourself, ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-call API can return PNG, JPEG, WebP, or PDF; the target URL is supplied as a request parameter. This example saves a WebP response:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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://example.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

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

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.