Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Short answer: run wkhtmltoimage directly first. Many current builds render without an X server, but some distribution packages—especially builds using unpatched Qt—still require one. If your binary fails with a display-related error, install Xvfb and invoke it through xvfb-run -a. Verify the behavior of the exact binary and package installed on your server rather than assuming either setup is universal.
What you are installing
wkhtmltoimage is an open-source command-line renderer that uses Qt WebKit to turn a URL or HTML file into an image. Its documented shape is:
wkhtmltoimage [OPTIONS]... <input file> <output file>
A URL can be the input:
wkhtmltoimage https://example.com page.png
For a local document, provide a file path instead:
wkhtmltoimage /var/www/site/index.html page.png
The upstream project describes its tools as headless. In practice, packaging matters: wrapper documentation and a Debian deployment example report that particular builds need an X server and therefore use Xvfb. Treat Xvfb as a compatibility workaround, not an unconditional prerequisite.
1. Check the binary, package and architecture
Before installing anything, identify what your server will execute:
#1 Best Overall
- 12th Intel Alder Lake N95 Processor – The GMKtec G3 S Mini PC is powered by the 12th Gen Intel N95 processor with 4 cores, 4 threads, 6MB cache and a burst frequency up to 3.4GHz. Compared with N100/N5105/N5100/N5095, the N95 delivers up to 36% overall performance improvement. Perfect for routine tasks, office work, and home entertainment, this compact mini desktop is more convenient than traditional bulky PCs.
- 8GB RAM & 256GB SSD Storage – Pre-installed with 8GB DDR4 memory and a fast 256GB M.2 2242 SSD, the G3 S mini desktop offers quicker startup, smoother multitasking, and faster file transfers. Enjoy seamless performance whether you’re working on multiple applications, browsing, or streaming content.
- Rich Interfaces & Connectivity – The G3 S mini computer comes equipped with USB 3.2 (up to 10Gbps), dual HDMI 2.0 (4K@60Hz), and a 3.5mm audio jack. With support for WiFi 5, Bluetooth 5.0, and Gigabit Ethernet (RJ45 1000MbE), it connects easily with monitors, projectors, printers, office equipment, and other peripherals, making it versatile for both home and business use.
- Dual 4K Display Support – Featuring upgraded Intel UHD Graphics (up to 1000MHz), the G3 S supports 4K video playback and AV1 decoding for a smooth viewing experience. With dual HDMI outputs, you can connect two 4K@60Hz displays simultaneously, enabling efficient multitasking for work and entertainment.
- GMKtec WARRANTY - GMKtec offers a 1-year limited GMKtec's warranty for each mini PC, starting from the date of the purchase. All defects due to design and workmanship are covered. With a professional after sales team always ready to attend to your needs, you can simply relax and enjoy your mini PC.
command -v wkhtmltoimage wkhtmltoimage --version wkhtmltoimage --help | head -n 40 uname -m cat /etc/os-release
Record the path printed by command -v. A system package, a manually downloaded release, and a binary placed in an application directory can have different Qt builds and option sets. Ubuntu package versions also vary by release: the Jammy manual documents 0.12.6-2, while the Bionic manual documents 0.12.4-1. Read your binary’s own help output because options and defaults can differ.
The official downloads page lists 0.12.6 as the stable series, released June 11, 2020, along with supported operating systems, distributions and architectures. Check the current downloads information for compatibility before replacing a distribution package.
2. Test whether Xvfb is actually needed
Run a small capture without a display wrapper:
mkdir -p /tmp/wkhtml-test wkhtmltoimage --width 1280 --height 900 https://example.com /tmp/wkhtml-test/example.png file /tmp/wkhtml-test/example.png ls -lh /tmp/wkhtml-test/example.png
A successful command should create a non-empty PNG and return exit status zero. To make the status explicit in a script:
Crashes, 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 minuteWindows 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 reinstallwkhtmltoimage https://example.com /tmp/wkhtml-test/example.png status=$? printf 'exit status: %sn' "$status" test "$status" -eq 0 -a -s /tmp/wkhtml-test/example.png
If the command reports that it cannot connect to a display, exits before rendering, or produces an empty file, test with Xvfb. Do not interpret an ordinary page error, blocked network request or JavaScript failure as proof that an X server is missing; inspect the diagnostic output and HTTP availability separately.
3. Install Xvfb when your build requires it
Ubuntu and Debian
Install the distribution package as root or through sudo:
sudo apt update sudo apt install xvfb
CentOS, RHEL and compatible systems
IMGKit documents the package name xorg-x11-server-Xvfb for CentOS-family systems:
sudo yum install xorg-x11-server-Xvfb
Package names and repositories differ by release. If a command cannot find the package, use your distribution’s package search and install the Xvfb package supplied for that release instead of copying a package from another distribution.
Confirm both executables
command -v xvfb-run xvfb-run --help | head -n 20 command -v wkhtmltoimage
IMGKit supports explicit paths for both executables when they are not in PATH. The same principle applies to shell scripts: use absolute paths or set PATH deliberately in services and cron jobs.
Rank #2
- High-Performance NAS with Powerful Procesor: Intel Core 5 320 is ideal for small offices, & More. You can enjoy smooth performance and seamless collaboration, while making use of advanced features like Docker and virtual machines. It works semalessly across every device inluding Windows, macOS, Linux, iOS, Android or Google services and so on.
- Better Way to Store Than External Drives: NAS offers centralized storage, automatic backups, remote access, and a wide range of RAID options for easy data recovery even if a drive fails. Massive Storage Capacity: Never worry about storage limits again. With up 144TB capacity, you can store 50 million 1MB photos or 98K 1.5GB movies,5 million 30MB songs! *Hard Drives not included.
- Secure Private Cloud: Retain 100% data ownership with advanced encryption to protect your files. Flexible permission management makes it easy to protect your privacy when collaborating with others.
- AI-Powered Photo Album: Automatically organizes your photos by recognizing faces, scenes, objects, and locations. It can also instantly remove duplicates, freeing up storage space and saving you time.
- User-Friendly App: Simple setup and easy file-sharing on Windows, macOS, Android, iOS, web browsers, and smart TVs, giving you secure access from any device.
4. Run wkhtmltoimage through Xvfb
The usual wrapper form is:
xvfb-run -a wkhtmltoimage https://example.com page.png
-a asks the wrapper to choose an available display number, reducing collisions when several jobs run at once. Use an absolute path if your service account has a restricted environment:
/usr/bin/xvfb-run -a /usr/local/bin/wkhtmltoimage https://example.com /srv/screenshots/example.png
For a local HTML file:
xvfb-run -a wkhtmltoimage /srv/site/index.html /srv/screenshots/index.png
Capture stderr and retain the exit code in automation:
set -o pipefail xvfb-run -a wkhtmltoimage https://example.com /srv/screenshots/example.png 2>/var/log/wkhtmltoimage.log status=$? if [ "$status" -ne 0 ] || [ ! -s /srv/screenshots/example.png ]; then echo "wkhtmltoimage failed (status $status)" >&2 exit "$status" fi
Xvfb supplies a virtual framebuffer; it does not fix invalid URLs, TLS failures, missing fonts, inaccessible local files or broken page scripts.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →5. Select rendering options deliberately
The Ubuntu Jammy manual documents the options below. Confirm availability with wkhtmltoimage --help on your installed build.
Dimensions
wkhtmltoimage --width 1440 --height 1000 https://example.com desktop.png
--width sets the viewport width and --height sets the viewport height. A full-page result can still depend on the build and page layout; test pages with responsive breakpoints, sticky headers and lazy-loaded content.
Format and quality
wkhtmltoimage --format png https://example.com page.png wkhtmltoimage --format jpg --quality 85 https://example.com page.jpg
Use PNG for sharp text and transparency-sensitive graphics; JPEG is usually smaller for photographic pages. The supported formats and quality behavior are build-dependent, so verify the generated file with file.
JavaScript timing
wkhtmltoimage --javascript-delay 2000 https://example.com rendered.png
The delay gives client-side code time to populate the page after initial load. If the page must not execute scripts, use:
wkhtmltoimage --disable-javascript https://example.com static.png
Disabling JavaScript can remove menus, charts or application content. Increasing delay increases per-request latency; prefer the shortest value that consistently captures the required state.
Local files and resource permissions
The manual documents both disabling local-file access and explicitly enabling it. Keep access disabled unless the page must load local CSS, images or fonts. When access is necessary, allow only the required directory:
Rank #3
- ✅ Next-Gen AI Mini PC with Linux Mint – Open Source Meets Power: ASUS NUC 14 Pro delivers cutting-edge performance with the latest Intel Core Ultra 7 155H (16C/22T) processor and Linux Mint pre-installed for a secure, open-source environment. Ideal for developers, AI researchers, and power users, this mini desktop combines efficiency and flexibility with Intel Arc graphics for stunning visuals and AI acceleration.
- ✅ Linux Mint for Developers, Creators & Businesses: Enjoy a lightweight, stable, and privacy-focused operating system that’s easy to use and developer-friendly. Linux Mint ensures a clutter-free experience without unnecessary bloatware, offering powerful open-source tools for programming, virtualization, and cloud-native development. This linux mint mini pc is perfect for professionals seeking freedom and security.
- ✅ Scalable Memory & Blazing-Fast Storage: With configurations from 16GB to 64GB DDR5 RAM (expandable up to 96GB) and 512GB–2TB M.2 2280 PCIe Gen4 x4 SSD, this Linux Mint ASUS NUC handles heavy workloads effortlessly. Optional SATA HDD (sold separately) support gives you extra storage for large projects, making it ideal for coding, AI model training, and big data processing without performance bottlenecks.
- ✅ Advanced Cooling for 24/7 Operation: ASUS NUC 14 Pro is engineered for silent and efficient cooling. The aluminum fin design, dual copper heat pipes, and optimized airflow system keep your mini PC cool during intense workloads. Perfect for running Linux-based servers, development environments, or AI inference tasks 24/7 without overheating.
- ✅ Ultimate Connectivity & Multi-Display Support: Packed with versatile ports—USB 3.2 Gen2 x 2 Type C, USB 3.2 Gen2 Type A, HDMI 2.1, Thunderbolt 4 & 2.5G Gigabit Ethernet—this Linux Mint mini desktop supports 8K or up to four 4K HDR displays, enabling seamless multitasking. With WiFi 6E and Bluetooth 5.3, it’s ideal for developers, creative professionals, and home offices. VESA mount-ready for space-saving setups. Plus, enjoy a free $99 wireless keyboard and mouse bundle to boost your workflow.
wkhtmltoimage --allow /srv/site/assets /srv/site/index.html /srv/screenshots/index.png
Do not enable broad filesystem access for untrusted input. A local HTML document can reference files that the rendering process is permitted to read.
Load-error handling
wkhtmltoimage --load-error-handling abort https://example.com page.png wkhtmltoimage --load-media-error-handling ignore https://example.com page.png
Choose behavior that matches your pipeline: aborting prevents silently accepting incomplete pages, while ignoring a failed image may be acceptable for non-critical captures. Exact accepted values can vary, so consult the target binary’s help or man page.
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 →6. Make a repeatable server script
This example tries the native headless path and then the Xvfb path only when requested. It validates that an output file exists and is non-empty:
#!/usr/bin/env bash
set -u
URL="${1:?Usage: $0 URL OUTPUT}"
OUTPUT="${2:?Usage: $0 URL OUTPUT}"
WKHTML="${WKHTMLTOIMAGE:-$(command -v wkhtmltoimage)}"
mkdir -p "$(dirname "$OUTPUT")"
if [ "${USE_XVFB:-0}" = "1" ]; then
exec xvfb-run -a "$WKHTML" --width 1280 --javascript-delay 1000 "$URL" "$OUTPUT"
else
exec "$WKHTML" --width 1280 --javascript-delay 1000 "$URL" "$OUTPUT"
fi
Run it as:
chmod +x capture.sh ./capture.sh https://example.com /srv/screenshots/example.png USE_XVFB=1 ./capture.sh https://example.com /srv/screenshots/example-xvfb.png
For systemd, set an explicit PATH, writable output directory and a timeout around the process. Do not run concurrent jobs without testing display allocation, CPU usage and temporary-directory behavior.
7. Troubleshoot common failures
“Cannot connect to display” or an immediate display error
Cause: this package expects an X server. Fix: install Xvfb, confirm xvfb-run is present, and run xvfb-run -a wkhtmltoimage .... If it still fails, capture stderr and check that the wrapper can create temporary files.
The command works in a shell but fails from cron or systemd
Cause: a reduced PATH, different working directory, permissions or environment variables. Fix: use absolute executable paths, set PATH explicitly, use absolute input/output paths and run under the same service account.
Recommended Free Tools
Blank or incomplete image
Possible causes: JavaScript has not finished, required resources are blocked, the URL redirects to an authentication page, or the page uses features unsupported by the Qt WebKit build. Try a measured --javascript-delay, inspect stderr, and compare with --disable-javascript to isolate script-related behavior. Confirm the output file size and content rather than relying only on exit status.
Images or styles fail from a local HTML file
Cause: local-file access is disabled or the resource lies outside an allowed directory. Fix: keep access restricted and add a narrowly scoped --allow path. Avoid enabling unrestricted access for user-supplied documents.
Rank #4
- Built for Local AI Development: AMD Ryzen AI Halo is designed for local AI development and inference, featuring 128GB unified memory and support for up to 200B parameter models to build and run intensive AI workloads locally.
- 128GB Unified Memory: Features 128GB LPDDR5x unified memory at 8000 MT/s with 256 GB/s memory bandwidth, providing a shared memory pool across the CPU, GPU, and NPU to support larger AI models.
- AMD Ryzen AI Max+ 395 Processor: Features 16 cores, 32 threads, and Zen 5 architecture, paired with AMD Radeon 8060S integrated graphics featuring 40 RDNA 3.5 compute units and an AMD XDNA 2 NPU with up to 50 TOPS.
- Linux AI Developer Platform: Purpose-built for Linux-based AI development with full AMD ROCm software support and preloaded tools, models, and workflows optimized for local AI development.
- Compact, Connected Design: Includes a 2TB M.2 SSD, 10GbE LAN, Wi-Fi 7, Bluetooth 5.4, USB-C connectivity, and HDMI 2.1b.
Segmentation fault
IMGKit’s README notes that some wkhtmltoimage versions can fail with segmentation faults. Run the exact command printed by the wrapper directly, preserve stderr, and test the same URL with a minimal option set. Then check whether a different package or supported upstream build is compatible with your distribution; do not assume every segmentation fault has one cause.
Fonts, TLS or proxy problems
Install the fonts your page requires, verify the server’s certificate store and configure network access for the service account. Test the URL with a command-line HTTP client separately. A successful HTTP request does not guarantee that the renderer’s WebKit engine can display every modern page feature.
Free tools Windows power users keep installed
One-click scans. No signup required.
8. Security and operational safeguards
The project downloads page warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it is running on!” The warning is about wkhtmltopdf, but the same Qt/WebKit rendering risk is relevant to wkhtmltoimage deployments. Treat URLs and HTML as hostile input.
- Run the renderer as a dedicated unprivileged user.
- Sanitize user HTML and JavaScript before rendering.
- Restrict outbound network access where possible.
- Keep local-file access disabled unless a narrowly scoped directory is required.
- Use process, memory and wall-clock limits and remove temporary files.
- Do not expose a renderer endpoint without authentication and input validation.
The upstream README and downloads page should be your reference for project-level behavior and security notices.
Or skip the browser setup
If maintaining Qt WebKit packages, Xvfb processes and rendering edge cases is not part of your application, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF, and it accepts the consent banner before capture while removing more than 60 known consent platforms, newsletter popups and chat widgets. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are reported in X-Page-Verdict and X-Billed headers and cost nothing.
cURL:
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)
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}`);
See the ScreenshotNeo documentation for authentication, output controls and the complete API. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Every plan includes features such as full-page lazy-image capture, CSS-selector element shots, custom JavaScript and CSS, waits, blocking, cookies and headers, device presets, PDFs, signed links, async webhooks, bulk capture of up to 100 URLs per call and a usage API. The free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Decision checklist
- Use the native command when your installed build succeeds without a display.
- Use Xvfb when that specific package requires an X server or native rendering fails with a display error.
- Pin and document the binary, distribution release, architecture and option set.
- Set dimensions, JavaScript delay, format, error handling and local-file permissions intentionally.
- Validate exit status and output content, not just file creation.
- Sandbox and sanitize every untrusted page or HTML document.
Frequently Asked Questions
Does every wkhtmltoimage installation require Xvfb?
No. The upstream project describes the tools as headless, while some distribution builds require an X server. Test the exact binary and use Xvfb only when that build needs it.
How can I see which options my package supports?
Run wkhtmltoimage --help and consult the man page for your distribution release; documented options differ between package versions.
What does xvfb-run -a do?
It starts a temporary virtual X server and chooses an available display number before launching wkhtmltoimage.
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.
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 minute

