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

“phpwkhtmltoimage” can mean two different PHP interfaces: the Image class in mikehaertl/phpwkhtmltopdf, or the wkhtmltoxImageConverter class from the PHP wkhtmltox extension. Their configuration APIs are not interchangeable. The wrapper accepts an options array when you construct Image or through setOptions(); the extension accepts a settings array in its converter constructor. Choose the interface you actually installed before setting format, crop, width, or loading behavior.

First identify which PHP interface you have

The name in the question does not identify a package or version precisely. Two documented interfaces are relevant, and their option conventions differ:

  • mikehaertl/phpwkhtmltopdf: a PHP wrapper with an Image class. Supply an associative options array when constructing Image, or set options later with $image->setOptions($options).
  • PHP wkhtmltox extension: its wkhtmltoxImageConverter class accepts a settings array in its constructor. The settings include keys such as fmt, crop.width, and web.loadImages.

Do not assume that a key documented for the extension is also accepted by the wrapper. Nor should you copy a command-line flag such as --crop-w into a PHP array. Confirm the exact names supported by the package and version installed in your project.

Check your dependency before changing code

Inspect your project’s Composer dependencies and PHP extensions, then identify the class your application instantiates. If your code creates an Image object from the mikehaertl wrapper, use that wrapper’s configuration route. If it creates wkhtmltoxImageConverter, use the extension’s settings vocabulary. If you are unsure, search the project for those class names and inspect the installed package or extension documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

This distinction matters most when you configure crop coordinates, output format, width, or load-error behavior: the underlying rendering tool has command-line options too, but those spellings are not automatically valid PHP keys.

Set options with the mikehaertl Image wrapper

The wrapper documentation describes two ways to provide options: pass an associative array to Image at construction, or call setOptions() on an existing instance. The following shows the documented configuration pattern without guessing option names that may vary by wrapper version:

<?php
use mikehaertlwkhtmltoImage;

$options = [
    // Add option names and values supported by your installed wrapper version.
];

$image = new Image($options);

// Alternatively, set or update options on an existing instance:
$image->setOptions($options);

Use either construction-time configuration or setOptions() according to how your application creates the object. The wrapper’s option names should be checked in its documentation for the installed version; the PHP extension keys listed below should not be presumed to work unchanged in this array.

Keep configuration separate from conversion

When troubleshooting, first verify that your selected settings reach the Image instance. Then check the wrapper’s documented conversion and output methods for your installed version. The available evidence establishes how to set options, but does not establish a complete conversion-call signature for every wrapper release, so do not paste a guessed rendering method into production.

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

Configure the PHP wkhtmltox extension settings

For the PHP extension, the documented settings array is passed to the wkhtmltoxImageConverter constructor. Its keys cover output format, transparency, dimensions, crop bounds, page loading, and rendering behavior. The examples below show the documented settings names and values; consult the installed extension’s documentation for the remaining converter lifecycle and output calls.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
<?php
$settings = [
    'fmt' => 'png',
    'transparent' => true,
    'screenWidth' => 1280,
    'smartWidth' => false,
    'crop.left' => 0,
    'crop.top' => 0,
    'crop.width' => 800,
    'crop.height' => 600,
    'load.jsdelay' => 500,
    'load.zoomFactor' => 1,
    'load.loadErrorHandling' => 'abort',
    'web.background' => true,
    'web.loadImages' => true,
    'web.enableJavascript' => true,
];

$converter = new wkhtmltoxImageConverter($settings);

This is a configuration example, not a complete save-to-file program: the documented facts here establish the constructor settings, but do not establish the extension’s conversion or output method signatures. Do not invent those calls; use the documentation matching the extension version installed on the target machine.

Choose an output format, transparency, and quality

Choose format based on how the image will be used. The extension documents JPEG (jpg), PNG, BMP, and SVG as format values. PNG or SVG is the relevant choice when you need transparency; the documented transparent setting makes the white background transparent for those formats. JPEG is lossy and has a quality compression factor; the documented example/default is 94, not a universal requirement for every image.

Need Extension setting Practical implication
Transparent background fmt set to PNG or SVG; transparent enabled Use only where the destination supports transparency. The documented behavior applies to PNG and SVG output.
Lossy compression fmt set to jpg; adjust quality JPEG trades image fidelity for compression. The documented example/default quality is 94.
Other supported output fmt set to BMP Choose it only if the downstream workflow calls for BMP; the source does not establish comparative size or performance figures.

Do not apply the JPEG quality setting as if it were a general PNG or SVG quality control. Output format and compression are separate decisions.

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.

Set the viewport and capture bounds

There are two distinct sizing questions: how wide the page is rendered, and which rectangle of that rendered page is captured. The extension settings screenWidth and smartWidth control rendering width behavior. Crop keys set a pixel-based rectangle: crop.left, crop.top, crop.width, and crop.height.

Choose a rendering width

Set the screen width to the layout you want the page to use. A narrower viewport may trigger a responsive mobile layout; a wider one may render desktop content. The command-line manual describes width as a guide unless smart width is disabled. Since CLI and PHP interfaces are not interchangeable, verify how the installed PHP interface exposes smart-width behavior rather than assuming the same flag spelling.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Crop to the required rectangle

Use crop coordinates when the output should contain only a region, rather than the whole rendered page. The values are pixels, with left and top locating the rectangle and width and height defining its bounds. Ensure the rectangle fits the rendered content at the chosen screen width; changing viewport width can change page layout and therefore what falls inside the crop.

For the CLI, corresponding controls are --crop-x, --crop-y, --crop-w, and --crop-h. Those flag names are useful when operating the command line, not as a substitute for checking the PHP array keys.

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

Control loading, JavaScript, and page rendering

A screenshot can omit content because the page was captured before it appeared, because images or JavaScript were disabled, or because page resources failed. The extension exposes loading and rendering settings that address these cases:

  • load.jsdelay configures a wait time for JavaScript-driven content.
  • load.zoomFactor sets zoom.
  • load.loadErrorHandling controls handling of load failures.
  • web.loadImages controls image loading.
  • web.enableJavascript controls JavaScript.
  • web.background controls background rendering.
  • web.minimumFontSize, web.defaultEncoding, and web.userStyleSheet affect typography, encoding, and applied styling.

If content is populated asynchronously, increase the documented delay only as much as needed and verify that the target page is actually ready. The command-line tool also provides --window-status to wait for a specified status value; do not assume the PHP interface exposes it with the same name or behavior.

Choose load-error behavior deliberately

The extension documents three load-error handling modes: abort, skip, and ignore. The choice affects whether a resource failure stops conversion, skips the affected object, or allows the process to continue despite a failure. Match this to your use case: a pipeline that must reject incomplete captures may prefer aborting; a capture workflow that can tolerate a missing resource may need a less strict mode. Confirm the exact semantics in the installed extension’s version documentation before relying on a mode for critical output.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Command-line equivalents are not PHP option keys

The wkhtmltoimage CLI provides controls corresponding to many of these settings, including --format, --quality, crop flags, --width, --height, image-loading switches, JavaScript switches, --zoom, and --window-status. They are useful if you invoke the executable directly, but their spelling does not define the PHP array syntax. In particular, CLI width behavior is a guide unless smart width is disabled. For PHP, follow the documentation for the wrapper or extension actually used.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common image-option problems

The option appears to have no effect

  • Confirm which API is instantiated: the mikehaertl Image wrapper or the extension’s wkhtmltoxImageConverter.
  • Check that the setting name belongs to that API. Extension keys such as fmt are not proven wrapper keys, and CLI flags are not PHP keys.
  • Verify whether options are supplied during construction or with the wrapper’s setOptions() method, and confirm the installed version’s documented behavior.

The output has a white background

For the extension, use PNG or SVG and enable transparent; the documented transparency behavior is for those output formats. A JPEG output is not the documented route for transparency.

The capture is too wide, narrow, or cut off

Separate viewport width from crop dimensions. Adjust screenWidth and smart-width behavior to establish the layout, then set the crop rectangle in pixels. On the CLI, smart width affects whether --width acts strictly; verify the corresponding behavior for the PHP interface.

Images or dynamic content are missing

Check web.loadImages and web.enableJavascript, then consider load.jsdelay for content that appears after scripts run. A delay cannot fix a resource that fails to load, so inspect the page’s loading behavior as well.

Conversion stops or returns incomplete content

Review load.loadErrorHandling and choose deliberately among abort, skip, and ignore. The strictest behavior is appropriate when incomplete output must not pass unnoticed; permissive handling may be appropriate when a partial image remains useful.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Or skip the browser setup

If the task is simply to capture a URL, ScreenshotNeo offers a screenshot API and MCP server rather than requiring you to configure a local wkhtmltoimage browser stack. Its API accepts a URL in one GET request; see the ScreenshotNeo API documentation for current options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. An MCP server exposes take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan. Create a free ScreenshotNeo account.

When to use each approach

Use the PHP wrapper or extension when your application already depends on that interface and needs its documented rendering controls. Use ScreenshotNeo when a hosted screenshot endpoint or MCP access better fits the application. The deciding point is not that one set of options is universally superior: it is whether you need local PHP integration and control over the installed renderer, or a URL-based capture service that handles capture and cleanup remotely.

Frequently Asked Questions

Does “phpwkhtmltoimage” identify one specific PHP package?

No. It may refer to the mikehaertl/phpwkhtmltopdf wrapper’s Image class or the separate wkhtmltox PHP extension’s Image Converter; check the class your code uses.

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

Can I use wkhtmltoimage command-line flags in a PHP options array?

Not safely. CLI flags and PHP option keys can differ, so use the documentation for the particular PHP interface and version you installed.

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.