How to Install wkhtmltoimage on Ubuntu 24.04
Install Ubuntu 24.04’s wkhtmltoimage command with apt, verify it, and troubleshoot package or rendering issues.
On Ubuntu 24.04 (Noble), install the wkhtmltopdf package; it provides the wkhtmltoimage executable. Run:
sudo apt update
sudo apt install wkhtmltopdf
Then check that the command is available:
command -v wkhtmltoimage
wkhtmltoimage --version
Ubuntu lists version 0.12.6-2build2 for amd64 in Noble. The package name is wkhtmltopdf even when you intend to use its image-conversion command, wkhtmltoimage. Ubuntu Noble package listing and the Noble wkhtmltoimage manpage document the package and executable.
Install and verify
- Refresh apt’s package metadata and install the package:
sudo apt update sudo apt install wkhtmltopdf - Confirm that your shell can find the executable and report its version:
command -v wkhtmltoimage wkhtmltoimage --version - Try a simple URL-to-image conversion:
wkhtmltoimage https://example.com page.png
The documented command form is wkhtmltoimage [OPTIONS]... <input file> <output file>. The example above illustrates the arguments; it is not a guarantee that a particular site will render identically across builds or environments.
Why the package and command names differ
Ubuntu’s Noble wkhtmltopdf package supplies command-line utilities for converting HTML to PDF or an image using WebKit. One of those utilities is wkhtmltoimage. Install the package through apt rather than searching for a separate package named after the executable.
The Noble package is published in Ubuntu’s Universe repository. If apt cannot locate it, check that Universe is enabled and refresh package metadata. The package listing identifies the amd64 build as 0.12.6-2build2; other architectures may have different availability or package details.
Choose the Ubuntu package or an upstream build
For a direct Ubuntu 24.04 installation, use Noble’s repository package. The upstream downloads page lists stable version 0.12.6, released June 11, 2020, and lists Ubuntu 22.04 (Jammy), but not Ubuntu 24.04 (Noble), among its Ubuntu download targets. A Jammy binary is therefore a separate compatibility choice, not an upstream-listed Noble build. See the upstream downloads page.
Build choice can affect output. The upstream project says some features require its patched Qt, and distribution builds can behave differently. If you rely on one of those features, identify which build your application needs and verify the required rendering behavior in your deployment environment. Do not assume a repository package and an upstream binary are interchangeable.
Options and practical usage
The basic call accepts an input URL or local HTML file, optional command-line options, and an output path. Check the installed manual for the options available in your build:
man wkhtmltoimage
wkhtmltoimage --help
For example, render a local file by supplying its path and an output filename:
wkhtmltoimage ./page.html ./page.png
Use an output extension that matches the image format you intend to create, and check the generated file in the application that will consume it. Page content that depends on external assets, scripts, fonts, authentication, or browser behavior may render differently from an ordinary interactive browser.
Security when rendering HTML
Rendering untrusted HTML or JavaScript can expose the machine running the renderer to serious risk. The wkhtmltopdf project 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!” See the project status and security guidance.
If you render user-submitted content, sanitize it before processing and consider where the renderer runs and what resources it can access. Treat externally supplied HTML and scripts as untrusted input.
Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
E: Unable to locate package wkhtmltopdf |
Package metadata is stale or the Universe repository is not enabled. | Run sudo apt update, confirm Universe is enabled in your Ubuntu software sources, then retry the install. |
wkhtmltoimage: command not found |
The installation may not have completed, or the executable is not on the current shell’s PATH. | Run command -v wkhtmltoimage, review the apt install output, and confirm that wkhtmltopdf is installed with dpkg -s wkhtmltopdf. |
| Rendering differs from an upstream example | The package may use a build without the patched Qt features that example depends on. | Check the expected feature against the upstream patched-Qt notes, identify your installed build, and validate behavior with a representative page. |
| An upstream binary will not run as expected on Noble | The upstream download list names Jammy, not Noble, as an Ubuntu target. | Prefer the Ubuntu Noble repository package for a direct Noble installation, or treat another release’s binary as a compatibility choice that needs validation. |
| A URL conversion produces incomplete or unexpected content | The page may depend on scripts, remote assets, session state, or behavior that differs between rendering builds. | Check the page in a controlled environment, inspect the installed command’s help and manual for relevant options, and compare against a simple local HTML file. |
Performance, reliability, and cost
The apt commands install Ubuntu’s packaged software; they do not establish a rendering speed or reliability guarantee. Conversion time and output depend on the page, its assets, the host environment, and the selected build. For repeatable use, record the Ubuntu release and package version, then validate representative inputs after package or environment changes.
For server-side use, account for the CPU and memory needed to render pages and for time spent loading remote content. Set operational limits in the application that invokes the command, and avoid rendering untrusted HTML without sanitization. The Ubuntu repository installation itself does not require a separate product subscription.
Or skip the browser setup
If your goal is to capture a website as an image rather than install and maintain a local renderer, ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-request API returns a screenshot or PDF; see the ScreenshotNeo API documentation.
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}`);
ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether the request was billed. Its MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.
FAQ
Do I need to install a separate package called wkhtmltoimage?
No. On Ubuntu 24.04, install wkhtmltopdf; that package provides the wkhtmltoimage command.
Does installing this package also give me wkhtmltopdf?
The package is named wkhtmltopdf and provides command-line conversion utilities, including wkhtmltoimage. Check the Noble package documentation for package details.
Is Ubuntu’s build the same as the upstream build?
Do not assume so. Upstream documents features that require patched Qt and notes that distribution builds can behave differently.


