What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use page.open(), set viewportSize, wait for the page to settle, then call page.render(). Leave clipRect unset for a full-page render, set it for a fixed region, use renderBase64() when you need an in-memory image, and adjust zoomFactor only for output scale. The complete examples below show each pattern and the failure cases that commonly make PhantomJS captures unreliable.
The basic PhantomJS screenshot workflow
PhantomJS creates a webpage object backed by a WebKit rendering engine. Open the target URL, check the callback status, and render only after a successful load. Rendering after a failed open can produce an empty or misleading file.
var page = require('webpage').create();
page.open('https://example.com/', function (status) {
if (status === 'success') {
page.render('example.png');
} else {
console.log('Unable to load the address');
}
phantom.exit();
});
page.render() accepts a filename. The documented output formats are PNG, JPEG, GIF and PDF; select the extension that matches the artifact you need. PNG is generally the practical choice for text, interfaces and diagrams, while JPEG can reduce the size of photographic captures. PDF is appropriate when the deliverable is a document rather than a bitmap.
Set the viewport before opening the page
page.viewportSize controls the dimensions used for layout. Set both width and height before page.open(); a desktop width can trigger a different responsive design than a phone width.
Recommended Free Tools
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
var page = require('webpage').create();
page.viewportSize = {
width: 1280,
height: 900
};
page.open('https://example.com/', function (status) {
if (status === 'success') {
page.render('desktop.png');
}
phantom.exit();
});
Viewport and output size are different
The viewport determines CSS layout and responsive breakpoints. It does not by itself determine whether the final pixels are enlarged or reduced. Use zoomFactor for render scale, while keeping the viewport fixed when comparing layouts.
Wait for the page to reach the state you want
A successful page.open() callback means the navigation completed; it does not guarantee that late JavaScript, fonts, images or animations have finished. The official viewport example waits 200 milliseconds before rendering. Treat that as a starting example, not a universal settling time.
var page = require('webpage').create();
page.viewportSize = { width: 1280, height: 900 };
page.open('https://example.com/', function (status) {
if (status !== 'success') {
console.log('Unable to load the address');
phantom.exit();
return;
}
window.setTimeout(function () {
page.render('settled.png');
phantom.exit();
}, 200);
});
For a page with a known readiness condition, prefer that condition to an arbitrary delay. You can poll for a selector or a value exposed by the page, then render. If the page continually animates, disable or wait for the animation in page-side JavaScript where possible; otherwise two captures can differ even with identical settings.
Full-page screenshots and fixed-region crops
Capture the page without a clip rectangle
When page.clipRect is not set, page.render() processes the whole page. Leave it unset for a full-page result and render only after content that affects page height has loaded.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Crop a known rectangle with clipRect
Set top, left, width and height to rasterize a region. Coordinates are page coordinates, so a rectangle beginning at left: 3 and top: 14 starts three pixels from the left and fourteen from the top.
var page = require('webpage').create();
page.viewportSize = { width: 1280, height: 900 };
page.clipRect = {
top: 0,
left: 0,
width: 800,
height: 600
};
page.open('https://example.com/', function (status) {
if (status === 'success') {
page.render('card.png');
}
phantom.exit();
});
Use a clip rectangle for a stable card, chart or viewport-sized image. It is not a substitute for finding an element’s changing position: if the page moves the component, calculate or expose a stable coordinate before assigning the rectangle.
Control pixel density with zoomFactor
page.zoomFactor scales the output of both page.render() and page.renderBase64(). Its documented default is 1 (100 percent).
var page = require('webpage').create();
page.viewportSize = { width: 1280, height: 900 };
page.zoomFactor = 1.5;
page.open('https://example.com/', function (status) {
if (status === 'success') {
page.render('retina-style.png');
}
phantom.exit();
});
Do not use zoom to fix a responsive layout problem. Change viewportSize when you need a different layout; change zoomFactor when you need a different raster scale. Keep both values constant while diagnosing visual differences.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Return a screenshot as Base64
page.renderBase64(format) returns an encoded image buffer instead of writing a file. The documented formats are PNG, GIF and JPEG. This is useful when the next step is an API response, database record or message queue.
var page = require('webpage').create();
page.viewportSize = { width: 1920, height: 1080 };
page.open('https://example.com/', function (status) {
if (status === 'success') {
var encoded = page.renderBase64('PNG');
// Send encoded to the next step in your pipeline.
console.log(encoded);
}
phantom.exit();
});
The returned string is Base64 data, not a data URL. If a consumer expects an image data URL, prepend the matching MIME type (for example, data:image/png;base64,) in your integration layer.
A complete, predictable capture script
This example combines a viewport, scale, readiness delay and crop. Remove clipRect for a full-page capture.
var page = require('webpage').create();
page.viewportSize = { width: 1280, height: 900 };
page.zoomFactor = 1;
page.open('https://example.com/', function (status) {
if (status !== 'success') {
console.log('Unable to load the address');
phantom.exit();
return;
}
window.setTimeout(function () {
page.clipRect = {
top: 0,
left: 0,
width: 1280,
height: 900
};
page.render('example.png');
phantom.exit();
}, 200);
});
Choose the right capture approach
| Requirement | PhantomJS setting | Result |
|---|---|---|
| Responsive desktop or mobile layout | viewportSize with width and height |
CSS layout is calculated for that simulated window |
| Whole page | Leave clipRect unset |
Render the page rather than a fixed crop |
| Card, chart or region | Set clipRect |
Only the defined rectangle is rasterized |
| File artifact | page.render('name.ext') |
PNG, JPEG, GIF or PDF output |
| In-memory pipeline | page.renderBase64('PNG') |
Base64 PNG, GIF or JPEG string |
| Thumbnail or higher-density output | zoomFactor |
Scaled render pixels without changing CSS layout |
Troubleshooting PhantomJS captures
The file is blank or missing
- Check the
statusargument and render only when it issuccess. - Confirm the process has permission to write the destination path.
- Use an absolute path while diagnosing path or working-directory mistakes.
The page is cut off
- Remove
clipRectif you intended a full-page render. - If a crop is intentional, increase its width, height, top or left values.
- Wait for lazy content that changes document height before rendering.
The layout is the wrong size
- Set
page.viewportSizebefore opening the URL. - Include both width and height; a missing height can change layout behavior.
- Use viewport dimensions for breakpoints, not
zoomFactor.
Fonts, images or widgets are missing
- Increase the readiness wait or replace it with a page-specific readiness check.
- Capture after asynchronous content has been inserted.
- Expect animated material to vary unless animation is stopped or synchronized.
Base64 output cannot be displayed
- Request a supported format: PNG, GIF or JPEG.
- Remember that
renderBase64()returns the encoded payload; add a MIME-prefixed data URL only when your consumer requires one.
Operational and cost considerations
A local PhantomJS script gives direct control over viewport, clipping, format and scale, but you must maintain the runtime, handle navigation failures, decide when a page is ready and store or transmit the output. Captures of dynamic pages are most reliable when the script has an explicit readiness rule rather than a single delay. For batch jobs, record the URL, viewport, clip rectangle, zoom factor, status and output path so a differing image can be reproduced.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Use PNG when pixel accuracy for text matters, JPEG when photographic output can tolerate lossy compression, and PDF when the consumer needs a document. Keep viewport and zoom settings fixed for visual regression comparisons; changing either makes an otherwise identical page incomparable.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
ScreenshotNeo is a hosted screenshot API and MCP server. It handles the browser session and returns PNG, JPEG, WebP or PDF from one request. Before capture it accepts cookie or consent banners 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 are not billed, and the response identifies the page verdict and billing result with X-Page-Verdict and X-Billed headers.
For a one-off image, use the API documented at https://screenshotneo.com/docs/:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Python request is:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
And 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}`);
ScreenshotNeo also supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, device presets or custom viewports, retina scale, PDF paper and page-range controls, custom CSS and JavaScript, clicks before capture, selector hiding, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed public image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.
An MCP server supplies take_screenshot, get_page_info and capture_pdf tools to Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without a card.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Frequently Asked Questions
Can PhantomJS capture PDF as well as images?
Yes. The documented page.render() outputs include PNG, JPEG, GIF and PDF; use the format that matches the consumer of your capture.
Should I always wait exactly 200 milliseconds?
No. Two hundred milliseconds is an example used in the viewport documentation. Choose a delay or readiness condition based on when the target page finishes its asynchronous work.
What is the difference between clipRect and viewportSize?
viewportSize controls layout. clipRect selects the rasterized region after layout has been established.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
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.

