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

If an wkhtmltoimage capture stays 1024 pixels wide, check two separate controls: the virtual screen size set by Xvfb and the renderer width set by wkhtmltoimage. Make sure the capture process connects to the intended Xvfb display, then set the renderer’s --width and, where supported, --disable-smart-width. Changing only one layer may not produce the output width you expect.

Why the capture can stay 1024 pixels wide

Xvfb and wkhtmltoimage control different parts of the capture environment. Xvfb supplies a virtual X display with a width, height, and color depth. The renderer has its own screen-width setting, and its smart-width behavior can affect whether the requested width acts as a limit or only a guide. The renderer must also connect to the X server whose dimensions you changed.

That gives you three questions to answer: what dimensions did the Xvfb process actually start with, which display is the capture process using, and what width behavior does the installed renderer support? A CSS rule, a zoom adjustment, or a change to an unrelated Xvfb process will not reliably fix a mismatch between those controls.

The X.Org Xvfb manual documents a default virtual screen of 1280x1024x8. That is a width of 1280 pixels, not 1024; the 1024 in that default is the height. If your output is exactly 1024 pixels wide, do not assume that this default explains it. Check the renderer option and the actual process configuration.

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

Fix the width in the right order

  1. Inspect the Xvfb launch command. Xvfb’s -screen argument takes a screen number followed by width, height, and depth in the form WxHxD. For a 1920-by-1080 virtual display at 24-bit depth, for example:
    Xvfb :99 -screen 0 1920x1080x24

    This is an example configuration, not a requirement for every host. Choose dimensions and depth that suit the application and available resources. The X.Org Xvfb manual also demonstrates the form Xvfb :1 -screen 0 1600x1200x32.

  2. Point the capture process at that display. If the Xvfb server uses display number :99, make that display available to the renderer:
    export DISPLAY=:99

    Or set the variable for a single command:

    DISPLAY=:99 wkhtmltoimage --width 1920 --disable-smart-width input.html output.png

    Use the display number actually assigned to your Xvfb process. Setting DISPLAY in a different shell, service, or container does not change the environment of a capture process that has already started.

  3. Set the renderer’s width explicitly. The Ubuntu Noble wkhtmltoimage manual documents --width <int> and describes it as a guide unless you also use --disable-smart-width. For a strict 1920-pixel renderer width, try:
    wkhtmltoimage --width 1920 --disable-smart-width input.html output.png

    Ubuntu Noble’s manual puts the distinction this way: “Set screen width, note that this is used only as a guide line. Use –disable-smart-width to make it strict.” Confirm that your installed binary recognizes both switches before relying on them; builds, downstream patches, and wrappers can differ.

  4. Check the dimensions of the resulting image. Do not rely only on a browser preview or a CSS width. Inspect the output file’s pixel dimensions using an image viewer or an image-inspection utility available in your environment. Compare the reported image width with the requested renderer width and the Xvfb screen width.

When selecting dimensions, configure the virtual display at least as wide and tall as the capture environment requires, and set the renderer width to the intended viewport. A larger Xvfb screen does not, by itself, establish that the renderer will use that width; a larger renderer width does not prove that the process connected to the intended display.

Choose the setting that matches how you call wkhtmltoimage

Command-line captures

For the CLI, start with the effective command line, environment, and the output file. A small, repeatable diagnostic run makes it easier to distinguish an option problem from a display problem:

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
printf 'DISPLAY=%sn' "$DISPLAY"
wkhtmltoimage --version
wkhtmltoimage --extended-help
wkhtmltoimage --width 1920 --disable-smart-width input.html output.png

If your binary does not support --extended-help, try --help. Read the local output rather than assuming that a switch documented for another package build is available. If the capture runs as a service, container, or scheduled job, gather these details from that process’s environment, not just from an interactive terminal.

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.

C library callers

If your application calls the wkhtmltoimage C library rather than launching the CLI, look at the image-global settings it passes. The library interface documents screenWidth as the screen width in pixels and smartWidth as the control for whether that width expands when content does not fit. Set and log those values in the application that creates the capture. A command-line flag in a separate shell will not alter settings passed by a library caller.

Zoom is not a viewport-width setting

--zoom is listed separately from the width controls. It changes scale; the documentation does not describe it as a replacement for setting the screen width or disabling smart width. Use zoom only when you intend to scale the rendered page, not as the first response to a fixed 1024-pixel output.

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.

Diagnose a result that is still 1024 pixels wide

  • The Xvfb command shows a smaller width than expected: Change the -screen dimensions on the Xvfb process that serves the capture. Check the complete WxHxD value; width is the first number.
  • The Xvfb command is correct, but the renderer may use another display: Log DISPLAY in the capture process and compare its display number with the Xvfb server number. Check the service or wrapper launch configuration as well as the command you expect it to run.
  • The renderer reports an unknown option: Inspect that installed binary’s --version and --help or --extended-help output. The Noble manual documents the switches, but that does not establish that every build or wrapper supports them. Use the option names accepted by your installed build, or investigate whether the wrapper invokes a different binary.
  • The image width does not match --width: Test with --disable-smart-width if the local help lists it. The manual describes --width as a guide without that switch, so setting the number alone may not make it strict.
  • The image width matches, but the page content looks too small or too large: Separate output dimensions from rendered scale. Check page CSS and viewport-dependent layout, then consider whether zoom is appropriate for the visual scale you need.
  • The failure occurs only in a service or container: Record the actual executable path, version, full effective command, DISPLAY, Xvfb launch arguments, and resulting image dimensions from that runtime. A wrapper, job runner, or container entrypoint may start a different Xvfb server or invoke a different binary than your manual test.

These checks are useful because the documented settings act at different layers. If the logs do not reveal which configuration is active, capture the process launch details and output dimensions together before changing more options. That evidence can show whether the limit comes from the display, the renderer, or a mismatch between them.

Performance and reliability considerations

A wider or taller virtual screen changes the display dimensions available to the capture; it does not guarantee that a page will lay itself out at the desired CSS viewport width. The renderer’s width control and the page’s own layout rules still matter. Validate representative pages at the target dimensions, especially if they use responsive breakpoints or content that overflows.

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.

Keep the Xvfb launch and capture environment explicit in scripts and service configuration. Log the effective display and renderer options when diagnosing a regression. Avoid treating a zoom change as a fix for a width mismatch: it can change visual scale without resolving which viewport or display the process used.

Rank #4
Sale
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

A 2014 wkhtmltopdf issue discussion describes an Xvfb and --use-xserver route in the PDF-tool context. That historical discussion is not proof that wkhtmltoimage requires the same option. For this image-capture problem, use the direct Xvfb and wkhtmltoimage settings described above, and verify behavior against the binary installed in your environment.

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

Or skip the browser setup

If the page is reachable by URL, ScreenshotNeo offers a screenshot API and MCP server as an alternative to maintaining an Xvfb and wkhtmltoimage setup. This does not replace local capture when the HTML is only available on your machine or network.

One GET request returns a screenshot; this cURL example saves the response as WebP. See the ScreenshotNeo API documentation for request details and options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie and consent banners are accepted like a visitor would accept them, and 60+ known consent platforms, newsletter popups, and chat widgets can be removed before capture; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; responses indicate the page verdict and billing status in headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The Free plan includes 1,000 screenshots a month with no card required; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.

Frequently Asked Questions

Does a 1024-pixel output prove that Xvfb is using its documented default?

No. The documented Xvfb default is 1280 pixels wide by 1024 pixels high; an output width of 1024 needs to be diagnosed from the actual Xvfb and renderer settings.

Does the historical wkhtmltopdf Xvfb example establish a wkhtmltoimage requirement?

No. It describes a route in the wkhtmltopdf context and should not be treated as a requirement for wkhtmltoimage.

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.

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