The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use a headless Chromium browser from PHP; the most straightforward option is Spatie Browsershot. It renders the page like a real browser, then writes a JPEG with an explicit quality setting:
<?php
require __DIR__ . '/vendor/autoload.php';
use SpatieBrowsershotBrowsershot;
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 80)
->windowSize(1440, 900)
->save(__DIR__ . '/page.jpg');
For a complete document, add fullPage(). To capture JavaScript-rendered content, wait for a page-specific selector before saving. The browser, Node.js/Puppeteer, and PHP package must be installed and kept compatible in your deployment.
What PHP needs to create a webpage JPEG
PHP itself does not lay out modern webpages. A screenshot requires a rendering engine that executes HTML, CSS, JavaScript, fonts, images, and lazy-loading code. The usual architecture is:
- PHP starts or contacts a headless Chromium process.
- Chromium navigates to a URL (or renders supplied HTML).
- The page reaches a defined ready state.
- Chromium captures pixels and encodes them as JPEG.
- PHP saves the bytes or sends them in an HTTP response.
Spatie Browsershot is a high-level PHP wrapper around Puppeteer and headless Chrome. It accepts a URL or HTML and exposes the capture controls most applications need.
#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.
Install and verify Browsershot
Application dependencies
Install Browsershot with Composer, then install the Node.js dependencies required by the version you selected. The exact PHP, Node.js, Chromium, and Puppeteer compatibility requirements vary by package release, so pin versions and check the release requirements before deploying.
composer require spatie/browsershot
Your server also needs a usable Chrome or Chromium executable and permission for the PHP process to launch it. In containers, install the browser and its system libraries in the image rather than relying on a developer workstation.
A minimal smoke test
<?php
require __DIR__ . '/vendor/autoload.php';
use SpatieBrowsershotBrowsershot;
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 80)
->save(__DIR__ . '/smoke-test.jpg');
echo "Wrote smoke-test.jpgn";
If this fails, test Chromium directly on the same host and inspect the process error before adding screenshot options. A browser executable that works interactively can still fail under a web-server user because of permissions, sandbox policy, missing fonts, or missing shared libraries.
Save a JPEG with deterministic dimensions
JPEG quality is a number from the image encoder’s quality scale; choose it deliberately because higher quality produces larger files. The viewport controls what responsive layout Chromium uses, while deviceScaleFactor() controls pixel density.
<?php
require __DIR__ . '/vendor/autoload.php';
use SpatieBrowsershotBrowsershot;
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 85)
->windowSize(1440, 900)
->deviceScaleFactor(2)
->save(__DIR__ . '/page-retina.jpg');
A larger device scale factor creates more pixels at the same CSS viewport and therefore usually a larger file. Keep the viewport and scale fixed when screenshots are compared in tests or used in a visual archive.
Capture the full page, a region, or one element
Full document
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 80)
->windowSize(1440, 900)
->fullPage()
->save(__DIR__ . '/full-page.jpg');
fullPage() expands the capture beyond the initial viewport so content below the fold is included. Very tall pages can consume substantial memory; for reports or archives, consider capturing sections separately.
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.
Rectangular clipping
Use clip($x, $y, $width, $height) to capture coordinates in CSS pixels relative to the page. Set the viewport first so responsive changes do not move the target unexpectedly.
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 82)
->windowSize(1440, 900)
->clip(120, 180, 900, 500)
->save(__DIR__ . '/region.jpg');
One DOM element
select($selector) captures the element identified by a CSS selector. Prefer a stable ID or data attribute over a presentation class.
Recommended Free Tools
Browsershot::url('https://example.com')
->setScreenshotType('jpeg', 85)
->select('[data-report-card]')
->save(__DIR__ . '/report-card.jpg');
Wait for JavaScript and lazy-loaded content
Navigation finishing does not mean application rendering is complete. Single-page apps, charts, web fonts, and images may appear after the initial response. Wait for a selector that your application adds only when the required content is ready.
Browsershot::url('https://example.com/dashboard')
->setScreenshotType('jpeg', 80)
->windowSize(1440, 900)
->waitForSelector('[data-screenshot-ready]')
->fullPage()
->save(__DIR__ . '/dashboard.jpg');
A readiness selector is more reliable than an arbitrary sleep because it tracks application state. When no selector exists, use a documented delay or JavaScript-aware wait supported by your Browsershot version. For pages that load images only after scrolling, use full-page capture and verify that the lazy-loading implementation actually responds to the browser’s scroll behavior.
Return JPEG bytes from a PHP endpoint
Writing a temporary file is unnecessary when the caller needs an HTTP image. Browsershot can return screenshot bytes; send them with the JPEG content type and a cache policy appropriate to your application.
<?php
require __DIR__ . '/vendor/autoload.php';
use SpatieBrowsershotBrowsershot;
$url = 'https://example.com';
$bytes = Browsershot::url($url)
->setScreenshotType('jpeg', 82)
->windowSize(1440, 900)
->fullPage()
->screenshot();
header('Content-Type: image/jpeg');
header('Content-Length: ' . strlen($bytes));
echo $bytes;
For APIs that need text transport, base64Screenshot() returns a base64 representation. It is larger than binary output, so use it only when the receiving protocol requires base64.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRank #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.
Security controls for URLs and HTML
Never pass unrestricted user input directly to a renderer. A screenshot service can be abused as a server-side request forgery primitive or made to read internal resources.
- Allow-list schemes and hostnames; normally permit only
httpsand approved domains. - Reject loopback, link-local, private-network, metadata-service, and Unix-socket targets.
- Limit URL length, redirects, response size, navigation time, and screenshot dimensions.
- Keep cookies, Authorization headers, and custom HTML isolated per request.
- Run Chromium with a restricted operating-system user and a container or sandbox appropriate to your environment.
- Sanitize HTML supplied by users; scripts in that HTML execute in the browser context.
Alternative PHP approaches
chrome-php/chrome
The lower-level chrome-php/chrome library exposes Chrome protocol controls directly. Its screenshot options include JPEG format, quality, clipping, and full-page capture using captureBeyondViewport together with getFullPageClip(). Choose it when you need protocol-level control and are willing to manage more browser lifecycle details yourself.
Raw Puppeteer
Puppeteer’s Page.screenshot() returns image bytes or base64 according to its options and offers extensive browser-side JavaScript control. It is the underlying Node API, so a PHP application needs a Node integration boundary such as a worker, queue job, or internal service. It is useful when page interaction is more complex than Browsershot’s PHP interface.
Compare these choices on four practical axes: fidelity on JavaScript-heavy pages, the operational work of installing Chromium and Node, control over viewport/full-page/element capture, and the JPEG quality and file-size policy your application needs.
Free tools Windows power users keep installed
One-click scans. No signup required.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF, while its browser handles the rendering infrastructure.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the ScreenshotNeo API documentation for response and option details. 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 disabled. Bot checks or 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 provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
It also supports full-page capture with lazy images, CSS-selector elements, dark mode, device presets and custom viewports, retina scale, PDF paper settings, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.
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
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account to begin.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Troubleshooting PHP JPEG screenshots
“Chrome failed to launch” or missing executable
Install Chromium and its shared libraries in the runtime image, then configure the executable path required by your Browsershot release. Confirm that the PHP worker user can execute it. Do not diagnose this only from a browser session running as your own user.
The output is blank or only shows a spinner
The page was captured before its application state became ready, or a script failed. Add a readiness selector, inspect browser console and network errors, and verify that required API requests are reachable from the server. A fixed delay is a fallback, not a substitute for a meaningful ready signal.
Images or fonts are missing
Check that assets are publicly reachable from the capture host, HTTPS certificates validate, and the browser user can resolve DNS. Wait for a selector that depends on the images or fonts being present. If authentication is required, provide narrowly scoped cookies or headers rather than embedding secrets in a public URL.
Full-page capture is cut off
Some layouts use nested scrolling containers instead of the document body. Capture the relevant element, remove or adjust its fixed height with custom CSS, or capture sections with clip(). Also check for an application that virtualizes rows and therefore never places all content in the DOM.
JPEG is too large or visibly degraded
Lower the encoder quality, reduce the viewport or device scale, and remove unnecessary full-page area. If text sharpness is more important than file size, increase quality or use PNG/WebP where your delivery requirements permit; keep JPEG when broad compatibility is the priority.
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.
Requests hang in production
Set a navigation and overall job timeout, cap page dimensions, and move captures to a queue worker rather than blocking a short web request. Log the target host, elapsed stages, browser exit status, and whether the failure occurred during navigation or encoding. Retry transient network failures with a limit, not indefinitely.
Operational checklist
- Pin compatible PHP, Browsershot, Node.js, Puppeteer, and Chromium versions.
- Use a fixed viewport, device scale, JPEG quality, and readiness condition for reproducible output.
- Validate and restrict every URL or HTML input.
- Record capture failures separately from successful files and monitor disk or object-storage usage.
- Test pages with consent banners, popups, lazy images, authentication, long documents, and responsive breakpoints.
- Choose synchronous bytes for small interactive responses and queued jobs for expensive full-page captures.
Frequently asked questions
Can PHP capture a webpage without JavaScript?
It can fetch HTML, but that does not reproduce a browser screenshot for pages whose content is created or styled by JavaScript. Use a Chromium-based renderer when visual fidelity matters.
Is JPEG suitable for text-heavy screenshots?
JPEG is compact and widely supported, but its lossy compression can soften small text or introduce artifacts. Tune quality and compare the result at the final display size.
Can I screenshot private pages?
Yes, if the browser receives the required session cookies or headers and your security design permits it. Treat those credentials as secrets and prevent untrusted users from selecting arbitrary private URLs.
Frequently Asked Questions
Does fullPage() include content loaded only after scrolling?
It requests a document-sized capture, but pages that virtualize or lazily insert content may require an application-specific scroll or readiness strategy.
Which JPEG quality should I choose?
Start around 80–85, then compare visual clarity and byte size using representative pages; the best value depends on text density, photographs, and your delivery limits.
Should screenshot jobs run inside a web request?
Small captures can, but full documents and slow third-party pages are safer in a queue worker with explicit timeouts and retries.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteQuick 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.

