Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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: wkhtmltoimage does not document a CSS-selector mode for capturing one element. It renders the page, then crops a rectangle defined by pixel coordinates. Measure the element’s rendered left and top position plus its width and height, and pass those values with --crop-x, --crop-y, --crop-w, and --crop-h.

This method is suitable when you can establish stable coordinates. If you need “the element matching this selector” on changing pages, a browser tool with native selector capture is usually a better fit.

What wkhtmltoimage can—and cannot—target

The documented image settings expose a rectangular crop: crop left and top define the origin, while crop width and height define the rectangle’s dimensions. The command-line equivalents are --crop-x, --crop-y, --crop-w, and --crop-h.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no documented option such as --selector or --element that accepts a CSS selector. Therefore, a “single-element screenshot” workflow has two separate stages:

#1 Best Overall
Sale
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
  1. Render the page in a known state and measure the target rectangle in rendered pixels.
  2. Invoke wkhtmltoimage with those four crop values.

The crop is geometric, not DOM-aware. If the page reflows, a cookie banner appears, fonts load at a different size, or the viewport changes, previously measured coordinates can miss the element.

Measure the element before running the crop

Use a predictable viewport

Set the same viewport width every time you measure and capture. wkhtmltoimage’s width setting acts as a layout guide unless smart width is disabled, so the final geometry can depend on both configuration and page behavior. Keep the input URL, width, zoom-related settings, and other rendering options identical between measurement and capture.

Record the four values

  • X: distance in rendered pixels from the left edge of the capture surface.
  • Y: distance in rendered pixels from the top edge.
  • Width: the target’s rendered width.
  • Height: the target’s rendered height.

Include any border, shadow, or intentional padding you want in the output. A box-shadow may extend beyond the element’s layout box, so inspect a trial image and enlarge the rectangle if the effect is clipped.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Account for page state

Measure after the target has reached the state you intend to publish. A late-loading image, injected component, expanded menu, or consent dialog changes coordinates. If you cannot make the page state deterministic, coordinate cropping will be fragile.

Basic command

Use this command shape, replacing the uppercase placeholders with integer pixel values and real paths:

wkhtmltoimage --crop-x X --crop-y Y --crop-w WIDTH --crop-h HEIGHT INPUT OUTPUT.png

For example, a rectangle beginning at (240, 680) and measuring 920 by 460 pixels would be:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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
wkhtmltoimage --crop-x 240 --crop-y 680 --crop-w 920 --crop-h 460 https://example.com card.png

The exact output formats and available switches vary by installed build. PNG is shown here because it is widely supported; check wkhtmltoimage --extended-help on your machine for the formats your binary accepts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Capture dynamic content reliably

The command reference documents controls for pages that are not ready at the first response:

  • --enable-javascript keeps JavaScript enabled when required by the page.
  • --javascript-delay MILLISECONDS waits after loading before rendering.
  • --window-status TEXT waits for the page’s window status to equal the supplied value.
  • --run-script JAVASCRIPT runs a script after loading; the option can be supplied repeatedly.

Choose the readiness signal that matches the page. A fixed delay is simple, but it is only a time guess: too short captures incomplete content, while too long slows every job. A page-controlled status value is more explicit when you control the application. A post-load script can trigger a state change, but it does not magically make unsupported browser APIs work.

These switches are documented capabilities, not a promise that every modern site will render correctly. wkhtmltoimage uses the Qt WebKit engine, and the main project repository is archived and read-only. Treat behavior as dependent on your installed build and downstream package. Release history also records a historical fix involving JavaScript delay and window-status handling, which is a reason to verify your binary rather than assume all versions behave identically.

A repeatable workflow

  1. Freeze inputs. Choose the URL, viewport width, output format, user-agent and any page options. Use the same values for measurement and capture.
  2. Render and inspect. Produce a full or generously sized image first so you can see the target and determine its position relative to the capture surface.
  3. Measure. Obtain the target’s rendered X, Y, width and height. Do not substitute CSS source dimensions if browser zoom, device scale, transforms or responsive layout alter the rendered result.
  4. Capture the rectangle. Pass the four crop flags and write to a new output file.
  5. Review edges. Check borders, shadows, rounded corners, text wrapping and transparent or white background expectations. Adjust the rectangle and repeat if needed.
  6. Automate only after it is stable. Store the coordinates with the viewport and page-state assumptions that produced them. Re-measure when the design or content layout changes.

Common failures and fixes

The image is shifted or the wrong element appears

Cause: the viewport, smart-width behavior, font metrics or page state differed from the measurement run.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Fix: use identical rendering options, make the viewport explicit, wait for fonts and asynchronous content, and measure again from the same capture surface.

The crop cuts off a shadow or border

Cause: the rectangle matches the layout box but not the pixels painted outside it.

Fix: increase X and Y margins slightly and increase width and height by the same amount, then inspect for unwanted surrounding content.

The target is blank

Cause: JavaScript had not populated it, a required script failed in Qt WebKit, or the crop coordinates point to an empty area.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: test a full-page capture, enable JavaScript where needed, use a documented delay or window-status condition, and confirm that the page actually supports the installed engine.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

The command rejects an option

Cause: package vendors and older builds can expose different switches.

Fix: run wkhtmltoimage --extended-help, compare the available crop and readiness flags, and install or invoke the intended binary explicitly.

Coordinates work once but fail on another URL or language

Cause: responsive breakpoints, translated text, different cookie state or variable content changed the layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: treat coordinates as page- and state-specific. For repeated jobs, control locale, cookies, viewport and content, or move to selector-based capture.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a CSS selector is the better abstraction

Coordinate cropping is a good one-off technique when the rectangle is known and stable. It becomes costly when you capture many pages whose content moves. The documented capture-website project offers an element option that accepts a CSS selector, as well as a fixed clipping option; its README states that selector mode, clipping mode and full-page capture are mutually exclusive. That is a capability distinction, not a claim of cross-platform performance or endorsement.

Best Value
Sale
Sceptre 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.

Choose based on the job:

Requirement wkhtmltoimage crop Selector-capable browser tool
Target definition Measured pixel rectangle CSS selector
Layout changes Must be re-measured Selector can follow the element if the DOM remains compatible
Dynamic readiness Use documented delay, status or script controls Depends on that tool’s browser and wait features
Best fit Stable, controlled pages and simple crops Repeatable element capture across changing layouts

Or skip the browser setup

ScreenshotNeo provides a website screenshot API with an element-by-CSS-selector option, so you can request the target directly instead of measuring pixel coordinates. Before capture it accepts the cookie or consent banner like a visitor 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 result. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

See the ScreenshotNeo API documentation for the complete option list. A one-call example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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}`);

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.

Cost, performance and maintenance considerations

  • Measurement overhead: wkhtmltoimage is inexpensive to run locally, but every layout change can add a manual or scripted measurement step.
  • Readiness trade-off: longer delays improve the chance of complete content but increase job time; status-based readiness is preferable when the page can signal completion.
  • Compatibility: an archived, read-only upstream repository means you should pin and document the exact package build used in production.
  • Operational checks: retain a sample output and verify dimensions, target visibility and edge padding after upgrades or site redesigns.

Frequently Asked Questions

Can I pass a CSS selector directly to wkhtmltoimage?

Not according to the documented image settings and command reference; those controls define a pixel rectangle rather than a DOM selector.

Are crop coordinates measured in CSS pixels or rendered pixels?

Use the rendered pixel geometry of the capture surface, because viewport and rendering configuration determine the final layout.

Will a JavaScript delay guarantee that an element is ready?

No. It only waits a specified time. A page-controlled status value or a verified post-load condition is more reliable when available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.