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.

“NULL output” is a symptom, not a diagnosis. First identify which output is actually missing: a failed conversion, a zero-length C API buffer, a missing or empty CLI file, or an image file that opens but contains blank pixels. Those cases have different checks. Record your wkhtmltoimage version and build, operating system, exact command or wrapper code, input HTML, stderr, HTTP error code, and—if using the C API—the output-buffer length before changing settings.

Identify which layer is returning NULL

Do not assume that a NULL pointer, a failed process exit, an absent file, and a blank screenshot mean the same thing. They are observations from different layers. A useful first pass is to establish exactly where the expected image disappears.

What you observe What to check
C API or wrapper returns NULL or empty bytes Conversion status, HTTP error code, output pointer, and reported output length.
CLI reports an error and no file appears Input and output arguments, process exit status, stderr, and whether the output path is writable.
File exists but is zero bytes or cannot be decoded File size, selected output format, conversion errors, and whether the integration wrote or flushed the output.
Image opens but is blank or incomplete Whether the page rendered, whether its CSS/images/fonts loaded, and whether JavaScript-generated content had time to appear.

For the CLI, record file existence, file size, and image contents separately from the process exit code. In a reported wkhtmltoimage 0.12.5 case, a remote image request failed with HTTP 403; the reporter still got an image file, while the process exited with a network error. The same report describes different behavior when writing to stdout. That is one environment-specific report, not a guarantee about other versions or installations.

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

Check C API conversion status and buffer length

The C API exposes conversion status separately from the output buffer. The upstream bindings document the conversion result as “returns 1 on success and 0 otherwise.” Do not infer that the image is usable from a pointer value or a log line alone: check the conversion result, then retrieve the HTTP error code and output pointer and length. A pointer with a zero length does not contain an image.

  1. Call the image conversion function and record its return value.
  2. Retrieve and record the HTTP error code after conversion.
  3. Retrieve the output pointer and its length using the API’s output function.
  4. Only pass the bytes onward if conversion succeeded and the length is nonzero; validate that the bytes decode as the format you requested.

The upstream example uses wkhtmltoimage_convert, wkhtmltoimage_http_error_code, and wkhtmltoimage_get_output in that order. Consult the bindings for the exact declarations and types used by your installed build; do not copy signatures from a different binding or assume the wrapper has identical ownership rules.

If conversion succeeds but your wrapper returns NULL

If the underlying conversion reports success and a nonzero output length but your application still receives NULL, the problem may be in the integration rather than page rendering. Trace how the wrapper handles the output pointer and length, how long the buffer remains valid, and how bytes are serialized or returned. This is a diagnostic inference from the API’s separate status and buffer values, not a confirmed explanation for any particular wrapper.

Check CLI arguments, exit status, and the output file

Confirm that the command points to the intended input and output, that the destination directory exists and is writable, and that the selected output format matches the filename and the way your application will read it. The manual documents format selection with --format and logging with --log-level. Use stderr and the chosen log level to capture details rather than treating a nonzero exit code as proof that no bytes were written.

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

Check the output after each run: does the file exist, is its size greater than zero, and can an image decoder open it? If it opens, inspect the pixels. These checks distinguish a write or conversion failure from a successful image file that depicts a blank page.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

File output and stdout are not interchangeable assumptions

If your integration writes to a file, diagnose that exact path first. If it uses stdout or an output buffer, test that route separately: the issue report above records different behavior for file and stdout output. Do not assume changing the output destination fixes the cause, or that a result in one mode predicts the result in another.

Investigate local and remote page resources

A page can produce a valid but incomplete screenshot when its resources fail to load. Inspect the input HTML and each referenced stylesheet, image, and font. For local assets, verify that file URLs point to the intended files and that the process can read those locations under the installed version’s local-file policy.

The project’s release history says local filesystem access was blocked by default in wkhtmltoimage 0.12.6. That makes the exact version important: check the release and build you actually run before changing permissions. The manual documents controls for enabling or disabling local-file access. Where supported, grant access only to the required local paths rather than opening access broadly.

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

For remote resources, record the requested URL and returned status, and inspect the environment’s authentication, proxy, TLS, and server responses. A 403 was reported in the specific 0.12.5 issue described above; it does not establish that every blank output is a network failure. The relevant question is whether the resources required by your input succeeded in your own run.

Check JavaScript and delayed rendering

If the page adds content after its initial HTML loads, compare a static version with the rendered version. The manual documents JavaScript control, a JavaScript delay, and waiting for a particular window.status value. These settings can help when content is demonstrably delayed; they are not universal fixes for an empty image.

  • Check whether JavaScript is enabled for the conversion.
  • If the page has a known delay, test an appropriate JavaScript delay and compare the resulting image.
  • If the page sets a reliable status value when rendering is complete, test the documented window-status wait behavior.
  • Check logs and resources again; a longer wait cannot fix a blocked file, failed request, or incorrect output path.

Reduce the input to isolate the cause

Once you have saved the original reproduction details, reduce the page rather than stacking flags at random. This helps separate a basic installation or output problem from dependencies and page behavior.

  1. Run the same command or API call with a minimal local HTML page containing plain text and no external assets or scripts.
  2. Verify conversion status or CLI output, then verify the bytes or file decode as the requested image format.
  3. Add the original stylesheets, images, fonts, and other dependencies back one at a time, checking which addition changes the result.
  4. Restore JavaScript-dependent content and test its completion behavior separately.
  5. If the failure occurs only through a wrapper or only through stdout/buffer output, compare that path with file output and inspect the wrapper’s buffer handling.

A minimal page that works narrows the problem to the original page or its resources. If it fails too, focus on the installed build, invocation, output path or buffer integration, and captured conversion errors.

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

Use the right diagnostic path

Situation Inspect first Evidence of success
C API, library, or wrapper Conversion result, HTTP error code, output pointer, and output length. Successful conversion, nonzero length, and bytes that decode in the requested format.
Command line Input/output arguments, exit status, stderr, file existence and size, and image contents. A nonzero output file that decodes as the requested format; interpret any network error separately.

Within either path, note whether the input is local or remote, whether its dependencies are local or remote, whether content is static or JavaScript-generated, and whether output goes to a file, buffer, or stdout. These distinctions determine which checks apply; the symptom alone cannot identify a single flag or root cause.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Common symptoms and next steps

Symptom Likely area to investigate Next check
Conversion returns 0 Conversion failure, input, resource loading, or runtime errors. Capture logs and HTTP error code; reproduce with a minimal local page.
Conversion returns 1 but API length is 0 Output-buffer retrieval or integration. Check output retrieval order and the wrapper’s pointer/length handling.
CLI exits with network error but an image exists A page or media request may have failed independently of file creation. Decode and inspect the file, then identify the failed request and its status.
Image decodes but is blank Page rendering, blocked dependencies, or content that appears after JavaScript runs. Inspect resource access and test JavaScript/wait behavior only where relevant.
Local images or styles are missing Incorrect file URL or local-file access policy. Verify paths and installed version; allow only needed paths where supported.

Version and maintenance context

Record the full version and build provenance before comparing results or changing access settings. The project release history dates version 0.12.6 to June 11, 2020, and states that local filesystem access was blocked by default in that version. The upstream repository was archived on January 2, 2023. Those dates do not tell you whether a particular package or fork receives maintenance today; check the provenance and maintenance status of the binary or library you installed.

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 your goal is to capture a rendered website rather than debug an existing wkhtmltoimage integration, ScreenshotNeo offers a one-call website screenshot API. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. It also provides an MCP server for AI agents, with tools including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

For API parameters and options, see the ScreenshotNeo documentation. This cURL request saves a screenshot of Stripe as WebP:

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

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

What to include when asking for help

There is not enough information in “NULL output” alone to name a reliable fix. Include the details needed to choose the correct branch:

  • Exact wkhtmltoimage version/build, operating system, and package or fork provenance.
  • Whether the call is CLI, C API, or a named wrapper, plus the exact command or relevant code.
  • Input HTML and whether its assets are local or remote, with sensitive data removed.
  • Conversion return value, HTTP error code, output length for C API calls, and complete relevant stderr/log output.
  • For CLI runs, exit status, output path, file size, and whether the image opens and what it shows.
  • Whether file output, stdout, or buffer output changes the behavior.

Frequently Asked Questions

Does a NULL result always mean wkhtmltoimage created no image?

No. Establish whether the missing value is the C API buffer, CLI file, or the rendered pixels; those outcomes can differ.

Should I enable local-file access to fix every empty screenshot?

No. Check whether the input actually depends on local files and verify the installed version’s policy before changing access.

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

Is wkhtmltoimage still maintained upstream?

The upstream repository was archived on January 2, 2023; that does not establish the maintenance status of a particular package or fork.

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.