To capture a webpage with PhantomJS on Ubuntu, save a short JavaScript file that opens the URL, checks the load status, and calls page.render(); then run it with phantomjs screenshot.js. The resulting image is written to the directory from which you ran the command. PhantomJS is a legacy tool: its repository is archived and development is suspended, and package availability depends on your Ubuntu release.
Capture a webpage with PhantomJS
PhantomJS is a command-line tool that runs a JavaScript file; it does not provide a screenshot GUI. The official quick start uses this same script-and-command pattern: PhantomJS Quick Start.
As an Amazon Associate I earn from qualifying purchases.
-
Create a file named
screenshot.jscontaining:var page = require('webpage').create(); page.open('https://example.com', function(status) { if (status === 'success') { page.render('screenshot.png'); } else { console.log('Unable to load the page.'); } phantom.exit(); }); -
In a terminal, change to the directory containing
screenshot.js, then run:Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.phantomjs screenshot.js -
When loading succeeds, find
screenshot.pngin the current working directory—the directory where you ran the command. The quick start documents this output location.#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
The page.open() callback receives a status of success or fail. This script renders only on success and calls phantom.exit() after either outcome so the process terminates. See the page.open API.
Choose the captured dimensions and format
Set the viewport or crop the output
To set the browser layout size, assign page.viewportSize before opening the URL. To render only a rectangle, set page.clipRect. For example, add these lines after creating the page and before page.open():
Rank #2
- 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
page.viewportSize = { width: 1280, height: 800 };
page.clipRect = { top: 0, left: 0, width: 1280, height: 800 };
The viewport controls the headless browser’s layout area; the clip rectangle selects the rendered region. The screen-capture guide demonstrates both settings.
Free tools Windows power users keep installed
One-click scans. No signup required.
Select an image format
Use a filename extension such as .png or .jpg; PhantomJS normally determines the render format from that extension. The render API lists PDF, PNG, JPEG, BMP, and PPM, with GIF support dependent on the Qt build. JPEG quality is an integer from 0 to 100 and defaults to 75; PNG’s quality option controls compression, not visible image quality. Details are in the render API.
Rank #3
- 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 the image background appears transparent, the page may not set a background color. The PhantomJS FAQ notes that a page with no background set may remain transparent and suggests setting a white body background with page script when that suits the page.
Check whether PhantomJS is available on your Ubuntu release
Do not assume PhantomJS can be installed from the default repositories on every Ubuntu version. The package evidence cited here is specific to Ubuntu Focal: its manpage records version 2.1.1+dfsg-2ubuntu1. Check package availability for your own Ubuntu release, then verify an installed binary with:
Rank #4
- 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
phantomjs --version
The PhantomJS GitHub repository was archived by its owner on May 30, 2023. Its README states, “Important: PhantomJS development is suspended until further notice.” The Ubuntu Focal manpage documents the Focal package, not availability on other releases. Legacy prebuilt binaries and compatibility can vary.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Troubleshoot common capture problems
-
phantomjs: command not found: the command is not available in the current shell, either because PhantomJS is not installed or its executable is not on the path. Check package availability for your Ubuntu release and confirm the executable is accessible before running the script.Best Value
SaleSceptre 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.
-
The script prints “Unable to load the page.”:
page.open()returned a status other thansuccess, so the script deliberately does not render. Confirm that the URL is correct and reachable from the machine, then try again. -
No screenshot file appears: look in the shell’s current working directory, not necessarily the directory where the script is stored. Run
pwdbefore starting PhantomJS to check that location. -
The capture has unexpected dimensions or content is cropped: check the viewport and
clipRectvalues. The viewport affects layout; the clip rectangle limits what is rendered.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
The image background is transparent: the page may leave its background unset. If appropriate for the capture, set a white body background through page script, as described in the FAQ.
Or skip the browser setup
ScreenshotNeo can return a webpage screenshot with one GET request. Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, and failed loads are never billed; the response identifies the page verdict and billing status. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.
Example cURL request:
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 documentation for request options. Sign up for 1,000 free screenshots a month with no card.
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.
Recommended Free Tools




