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

PhantomJS screenshots change size because two different settings control two different rectangles. page.viewportSize sets the headless browser’s viewport and therefore the responsive layout. page.clipRect sets the rectangle that page.render() rasterizes. If you omit clipRect, PhantomJS renders the entire page, which can be much taller than the viewport. Set both values explicitly for a predictable fixed-size image; leave clipRect unset only when a full-page capture is intentional.

The two dimensions PhantomJS keeps separate

A browser viewport is the coordinate space in which a page lays itself out. The screenshot bounds are the region copied into the output file. PhantomJS exposes those concepts as separate properties:

Setting What it controls Typical symptom when it is wrong
page.viewportSize The headless browser viewport, in CSS pixels; it affects responsive breakpoints, line wrapping and element positions. The page switches to a mobile or tablet layout, or text wraps differently between runs.
page.clipRect The rasterized rectangle, defined by top, left, width and height. The output is unexpectedly tall, cropped, offset or a different pixel size.
No clipRect page.render() processes the entire webpage. A short viewport produces a very tall image because all page content is included.
paperSize PDF page dimensions and margins. A PDF has unexpected paper dimensions even though raster settings are correct.

The names are not interchangeable. A 1024-pixel-wide viewport can produce a 1024-pixel-wide image with a 3,000-pixel height when the page is long and no clipping rectangle is supplied. Conversely, a large viewport can be cropped to a small output rectangle. Decide first whether you need a viewport-sized image, a selected region, or the complete page.

Make a fixed-size 1024 × 768 screenshot

Set the viewport and clipping rectangle before opening the URL. The following is the complete PhantomJS pattern for a 1024 × 768 raster capture:

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
var page = require('webpage').create();

page.viewportSize = { width: 1024, height: 768 };
page.clipRect = { top: 0, left: 0, width: 1024, height: 768 };

page.open('http://example.com/', function (status) {
  if (status === 'success') {
    page.render('capture.png');
  } else {
    console.error('Page open failed: ' + status);
  }
  phantom.exit();
});

The numbers are an example, not a universal standard. Choose a viewport width that triggers the layout you want, then choose a clip rectangle that covers the exact output region. Keeping the two rectangles the same size gives a viewport-sized image, but they do not have to match. For example, a 1440 × 900 viewport can be clipped to a 1200 × 700 panel if you deliberately want only that area.

Set values before navigation

  1. Create the page with require('webpage').create().
  2. Assign page.viewportSize.
  3. Assign all four page.clipRect fields.
  4. Call page.open() and render only after a successful status.
  5. Exit PhantomJS after rendering so the process does not remain alive.

Setting the viewport after the page has loaded can leave you diagnosing a layout produced at an earlier width. Establish it before page.open() whenever possible.

Choose between a viewport shot, a selected crop and a full page

Viewport-sized output

Use matching viewport and clip dimensions when you need a stable “what is visible in the browser window” image. This is appropriate for visual regression baselines, documentation thumbnails and fixed-size test fixtures. A change in viewport width can still alter the page’s responsive layout even when the output dimensions remain constant.

A specific region

Use clipRect to select a bounded region. left and top move the rectangle; width and height determine its size. An incorrect offset can look like a scaling problem when it is actually a crop that starts too far left, right, high or low. Keep the rectangle inside the page area you intend to capture and verify the result after layout changes.

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.
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

Full-page output

Leave clipRect unset when the requirement is to include the complete webpage. The resulting height follows the rendered document, not the viewport height. This is intentional for long-form archives or pages where every section must be preserved, but it is unsuitable for a fixed-pixel contract.

Diagnose which dimension is changing

What you observe Likely cause Check or fix
Different line wrapping, breakpoints or navigation The viewport width or height differs between runs. Log the values and assign page.viewportSize before page.open().
Image height follows the amount of page content clipRect is unset, so the whole webpage is rendered. Set an explicit rectangle for bounded output, or keep it unset deliberately for full-page capture.
Correct dimensions but wrong content location top or left is offset. Inspect all four clip fields; do not change viewport dimensions to compensate for an offset.
Output dimensions seem correct but the PDF page is wrong PDF sizing is controlled separately. Configure paperSize for the PDF’s format, dimensions, units, margins or orientation.
Changing PNG to JPEG appears to “fix” size The filename extension changes encoding, not the layout rectangle. Investigate viewport and clipping first; page.render() infers format from the extension.

When comparing captures, record the URL, viewport values, clip values, output extension and whether the run was intended to be full-page. This prevents a full-page image from being mistaken for a viewport regression.

Raster screenshots and PDFs use different controls

For PNG, JPEG, BMP, PPM and other raster output supported by your PhantomJS build, the relevant controls are the viewport and render clipping. PhantomJS infers the output format from the filename extension; GIF support depends on the Qt build. The extension does not define the pixel rectangle.

PDF output follows a different model. Set page.paperSize to control named paper formats or explicit dimensions, units, margins and landscape orientation. Do not expect a raster clipRect to define PDF page size, or a PDF paper setting to change the browser’s responsive viewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Reliable capture procedure for existing scripts

  1. Define the contract. Write down whether the result is a fixed viewport, a selected region or a full page, and the required pixel dimensions or PDF paper size.
  2. Choose the layout viewport. Select a width and height that produce the intended responsive design. The width is usually the critical breakpoint value.
  3. Set the crop deliberately. For fixed output, assign all of top, left, width and height. For full page, omit clipRect intentionally and document that choice.
  4. Navigate after configuration. Set the viewport before page.open(), then render only when the callback reports success.
  5. Verify the artifact. Inspect both pixel dimensions and content boundaries. A file can have the expected size while clipping a header or starting below the intended origin.
  6. Keep the settings stable. Store capture dimensions in one configuration object rather than scattering literals through multiple scripts.

PhantomJS uses QtWebKit and its project homepage says, “Important: PhantomJS development is suspended until further notice.” Treat these instructions as maintenance guidance for existing automation, not as advice to build a new production browser stack around an actively maintained engine. The available documentation does not establish a particular release-specific sizing defect or a currently supported release.

Common failure modes and fixes

The screenshot is much taller than expected

Confirm whether page.clipRect was ever assigned. An unset rectangle invokes full-webpage rendering. If you need 1024 × 768, assign that exact rectangle before navigation and render.

The page looks mobile even though the image is wide

The output file’s width does not prove that the page laid out at that width. Check page.viewportSize.width, set it before opening the page, and look for code that changes it later. Also ensure that separate workers or scripts are not using different configuration values.

The right size is produced, but content is cut off

Inspect clipRect.top and left first, then confirm that the rectangle’s width and height cover the intended region. A fixed crop cannot include content outside its bounds; use full-page mode when the requirement is to preserve the entire document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

Rendering never creates an image

Check the status argument in the page.open() callback and render only on success. Log failures, verify the URL is reachable from the capture environment, and ensure that phantom.exit() is called after the callback rather than before page.render().

The PDF has the wrong paper shape

Configure paperSize; changing clipRect addresses raster cropping, not PDF page dimensions. For a PDF, specify the required format, units, margins and orientation in the paper-size object.

Different machines produce different layouts

First normalize the viewport and clip settings. If those match, compare the PhantomJS/QtWebKit environment and page response, because the documented sizing controls cannot make differing page content or engine behavior identical.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and repeatability considerations

A full-page render can create a substantially taller bitmap than a viewport capture, increasing memory use and file size. Use a bounded clip when downstream systems expect a fixed artifact, and reserve full-page mode for workflows that need every section. Fixed dimensions also simplify cache keys, visual-diff comparisons and storage quotas.

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.

For repeatable results, keep the URL, viewport, clip rectangle, output format and PDF settings together in version-controlled configuration. When a page redesign changes breakpoints or content height, decide whether that is an intentional baseline update or a capture regression before replacing reference images.

Or skip the browser setup

If you only need a dependable website image rather than a legacy PhantomJS runtime, ScreenshotNeo provides a single HTTP request for PNG, JPEG, WebP or PDF output. Its API can set a viewport or device preset, capture full pages with lazy images loaded, select an element by CSS selector, use retina scale, resize images, apply custom CSS or JavaScript, wait for a selector, delay or network idle, and set PDF paper size, margins, orientation and page ranges. It also supports custom headers, cookies, user agents, timezone and geolocation when a page requires them.

Example cURL request (the ScreenshotNeo documentation lists the available parameters):

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

Python:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free ScreenshotNeo plan.

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

A practical decision checklist

  • Need the browser-window view at an exact size? Set matching viewportSize and clipRect.
  • Need a component or panel only? Keep the layout viewport appropriate to the page and use clipRect for the region.
  • Need every page section? Omit clipRect intentionally and expect a content-dependent height.
  • Need PDF paper dimensions? Configure paperSize, not raster clipping.
  • Maintaining an old PhantomJS job? Pin and document the environment because PhantomJS development is suspended.
  • Need automated cleanup, billing visibility or AI-agent access? Use the ScreenshotNeo request instead of maintaining browser setup.

Frequently Asked Questions

Can I set a clip rectangle larger than the viewport?

You can request a rectangle that extends beyond the visible viewport, but verify the resulting capture in your PhantomJS build. If the goal is simply to include all page content, full-page rendering without a clip rectangle is the clearer choice.

Does changing the output filename change screenshot dimensions?

No. The filename extension selects the rendered format; dimensions come from the viewport, clip rectangle or, for PDFs, paper-size settings.

Why does a fixed-width screenshot still change from one run to another?

A fixed pixel size does not freeze page content. Responsive breakpoints, page responses and the QtWebKit environment can still alter what is rendered inside the same rectangle.

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.

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.