Recommended Free Tools
To convert HTML to a JPG in PHP, use wkhtmltoimage with the page as input and a .jpg output path. You can either call the command-line program from PHP or use the PHP wkhtmltox extension. The right choice depends on whether your server can run a compatible binary or extension. For Indian websites, verify UTF-8, fonts and representative local-language text on the actual deployment host; the documentation does not certify rendering accuracy for any particular Indian script.
Choose the CLI or PHP extension
Both routes can produce a JPEG. The CLI is suitable when you can install and execute a matching wkhtmltoimage binary. The PHP binding is an option when its extension and underlying libraries are compatible with your PHP and operating-system deployment.
As an Amazon Associate I earn from qualifying purchases.
| Route | Use it when | Check before deployment |
|---|---|---|
| CLI launched from PHP | Your host can install and execute the binary, and you want to keep conversion in a separate process. | Binary version and architecture, runtime libraries, safe argument handling, exit status and output-directory permissions. |
PHP wkhtmltox image converter |
The extension and its libraries are available and compatible with your PHP and operating system. | Extension availability, fmt, output path, dimensions, quality, loading settings and runtime dependencies. |
Neither route is universally easier. The project describes distribution-specific packages and notes that a static Qt build still relies on system packages. Generic binaries may fail across libc variants; Alpine uses musl rather than glibc. Check the wkhtmltopdf project downloads page and the PHP wkhtmltox introduction against your target host.
Convert HTML to JPG with the command-line program
The documented command form is wkhtmltoimage [OPTIONS] <input file> <output file>. For a local HTML file, a basic example is:
#1 Best Overall
- RCA Female to HDMI Video Converters Adapter : The cable is used to convert analog composite input to HDMI 1080p output, displayed on a 1080p HD TV/TV/monitor.
- Input ports: 1xRCA Female (Yellow, White, Red), Output ports: 1xHDMI 1.3 1080p. NOT support 3D and 4K, NOT support HDMI Converts to AV
- AV to HDMI Converter: Plug and Play, Easy to Install and Operate, Powered by External USB Cable. Note: Please hook up the USB power cable (included) to 5V 1Apower source during use (not included power supply ).
- Support PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV formats input. For PS2,PS3,Xbox,N64,STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- You Will Get : 1x RCA Female TO HDMI Converter, 1xHDMI cable, 1xUSB cable, 1xUser Manual. ONE YEAR WARRANTY - if you are not satisfied for any reason whatsoever, do not hesitate to contact us .
wkhtmltoimage --format jpg --quality 90 --width 1200 /path/to/page.html /path/to/page.jpg
This uses a JPEG quality value of 90 and a width of 1200 as illustrative settings, not measured optimal values. The CLI documents --format, --quality and --width; its width option is a guide unless smart width is disabled. See the wkhtmltoimage(1) manpage for the installed version’s options.
Call wkhtmltoimage safely from PHP
Use a process API that accepts an argument array rather than building a shell command by concatenating user-controlled strings. The following example uses PHP’s proc_open with an argument array, available in modern PHP versions. Keep both paths under application control, and adapt the PHP executable and paths for your server.
<?php
$input = '/srv/app/render/page.html';
$output = '/srv/app/render/page.jpg';
$command = ['wkhtmltoimage', '--format', 'jpg', '--quality', '90', '--width', '1200', $input, $output];
$descriptors = [
0 => ['pipe', 'r'],
1 => ['pipe', 'w'],
2 => ['pipe', 'w'],
];
$process = proc_open($command, $descriptors, $pipes);
if (!is_resource($process)) {
throw new RuntimeException('Could not start wkhtmltoimage.');
}
fclose($pipes[0]);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$exitCode = proc_close($process);
if ($exitCode !== 0 || !is_file($output) || filesize($output) === 0) {
throw new RuntimeException('JPG conversion failed: ' . $stderr . $stdout);
}
// Optional validation that the result can be decoded as an image.
if (getimagesize($output) === false) {
throw new RuntimeException('Conversion output is not a valid image.');
}
?>
For older PHP runtimes or process libraries that do not accept an argument array, use the library’s documented escaping and argument-passing facilities; do not interpolate request data into a shell string. Restrict which HTML and resources the converter can access, set sensible execution and resource limits for your application, and report failures without exposing sensitive server paths to visitors.
Rank #2
- RCA to HDMI Converter: Converts analog RCA composite (Yellow, White, Red) input to HDMI 720P/1080P output on HDTVs/Monitors. Only support RCA to HDMI. NOT Support HDMI to RCA!
- Plug to Play: AV to HDMI converter doesn't need extra drivers, just plug and play, easy to use. Please hook up the USB power cable (included) to 5V power adapter when using this RCA to HDMI adapter.
- Wide Compatibility: This av hdmi converter supports for all standard TV formats such as PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N. Provide advanced signal processing and make videos come to life.
- Extensive Use: Composite to HDMI converter widely applied to PS2, PS3, Xbox, N64, WII, STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- Attention & Package: Please ensure to connect this rca to hdmi converter to power source to make it work. Package include: 1x RCA to HDMI Converter, 1* Micro USB cable (adapter not included), 1*User Manual. Please free feel to contact us if you have any product problems.
Use the PHP wkhtmltox image converter
If the PHP wkhtmltox extension is installed and compatible with the deployed PHP runtime and operating system, the image converter can set JPEG output and rendering options directly:
<?php
$html = '<!doctype html><html><head><meta charset="utf-8"></head><body><h1>Namaste</h1></body></html>';
$converter = new wkhtmltoxImageConverter($html, [
'out' => '/srv/app/render/page.jpg',
'fmt' => 'jpg',
'screenWidth' => 1200,
'quality' => 90,
'load.jsdelay' => 500,
]);
$converter->convert();
?>
The documented constructor supports fmt, out, screenWidth, JPEG quality and load.jsdelay. The PHP manual lists 94 as the documented default quality; choose a value based on the output size and visual quality you need. Confirm the extension’s availability and runtime compatibility before relying on this example in production. See the PHP image converter constructor reference.
Control dimensions, loading and resources
Set the capture width and crop
Set a width that fits the intended use, then inspect the generated image. In the PHP binding, screenWidth controls the screen width; crop settings can specify left, top, width and height. The CLI exposes width and crop options. A wide layout can become difficult to read when reduced, while a crop can omit content if it does not account for the page’s actual layout.
Rank #3
- Connect Classic RCA Devices to HDMI Displays: Bring older AV equipment back into use by converting yellow, white and red composite RCA signals into HDMI output for newer TVs, monitors and projectors. Choose between 720P and 1080P output at 60Hz to match your display. Please note that this av to hdmi adapter is built specifically for connecting an RCA/AV source to an HDMI display; it cannot convert an HDMI source to RCA/AV.
- Complete 3-Cable Set Included: Includes separate RCA, HDMI and Micro USB cables for video/audio connection, HDMI output and power. The RCA and HDMI cables are detachable for flexible placement and use with compatible equipment. USB power is required for operation. A Micro USB cable is included; a 5V/1A power adapter is not included.
- Selectable 720P and 1080P Output: Use the built-in resolution switch to select 720P or 1080P output at 60Hz based on your TV or monitor. No software or drivers are required. Connect the RCA source, HDMI display and USB power, then select the desired output resolution.
- Compatibility with Legacy AV Devices: Compatible with RCA-output VCRs, VHS players, DVD players, set-top boxes and karaoke systems, as well as compatible PS1, PS2, PS3, Xbox, Wii, N64, SNES and GameCube systems using RCA/AV output. Supports PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M and PAL/N analog input formats.
- HDMI Output Based on the Original Source:Converts an analog RCA signal to HDMI output with selectable resolution up to 1080P. The av to hdmi converter changes the signal format but does not turn lower-resolution VHS footage or classic game graphics into native HD content. Final picture quality depends on the original source, connected equipment and display. For stable operation, connect the included USB power cable to a 5V/1A USB power source.
Choose JPEG quality deliberately
The CLI’s documented --quality range is 0–100. The PHP binding also has a JPEG quality setting and documents 94 as its default. Higher quality can produce larger files; inspect the output at its intended display size rather than assuming one value suits every page.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsWait for page content to be ready
For the PHP binding, load.jsdelay adds a delay before capture. The CLI supports waiting for a named window.status value and running additional scripts. A fixed delay is a fallback, not proof that content has finished loading. If you control the page, an explicit ready signal is less arbitrary than guessing a delay. External CSS, images and fonts also need to be reachable from the conversion host.
Constrain local-file access and inputs
The PHP binding exposes a setting to block local-file access. Keep templates and permitted resources constrained, especially if any HTML is user-influenced. Do not assume that toggling one access setting makes arbitrary HTML safe.
Rank #4
- RCA to HDMI Converter: Converts analog RCA composite (Yellow, White, Red) input to HDMI 720P/1080P (60HZ) output, displayed on smart TV, projector and HDTV monitor. Making video come alive, giving the most realistic HD visual experience. Important Note: RCA inputs for HDMI output only!
- Easy to Use: GINGIN Mini RCA to HDMI Adapter need no extra driver, portable, flexible, just plug and play. Please hook up the USB power cable (included) to 5V 1A power adapter during use.
- Widely Used: This AV to HDMI Adapter is widely applied to PS1, PS2, PS3, Xbox, N64, WII, STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- Broad Compatibility: This Audio Video to HDMI Converter supports source formats of PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV. Provide advanced signal processing with great precision, colors, resolutions, and details.
- Package&After-sales Service: Package Include: 1*CVBS to HDMI Converter, 1*USB Power Cable(2.6ft/0.8m), 1*HDMI Cable(3.3ft/1m), 1*Male RCA Cables(3.3ft/1m), 1*User Manual. We provide 18 months after-sales service and 30 days no hesitate money back.
Check Indian-language rendering on the deployment host
There is no cited certification or measurement establishing accurate output for a particular Indian script or font. Encoding and installed fonts can vary by host, so render representative pages in the same server or container image that will produce the JPG.
- Use UTF-8 consistently in HTML and input files. The PHP settings documentation describes UTF-8 as the default encoding where none is specified.
- Install the fonts your site actually uses in the server image, and confirm that fontconfig and freetype can use them. The project notes that font and library differences affect packaging and runtime.
- Inspect representative text in the scripts your site serves, including conjuncts, matras, punctuation and mixed Latin/local-script content.
- Check long names, addresses and localized labels for clipping or unexpected wrapping at the selected width and crop.
- Verify that remote stylesheets, images and fonts can be fetched from the rendering environment, or provide an appropriately controlled local resource path.
The PHP converter settings describe encoding-related options, and the project download notes discuss platform dependencies. Neither establishes fidelity for a specific language or deployment; inspect your own generated images.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Security, compatibility and reliability
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!” The warning appears on its downloads page. Treat user-controlled HTML and JavaScript as a serious server-side security risk. Sanitization alone is not a complete sandbox: keep inputs controlled, restrict network and local-file access where possible, limit permissions and resource consumption, and avoid shell interpolation.
Best Value
- RCA to HDMI Converter: Converts analog RCA composite (Yellow, White, Red) input to HDMI 720P/1080P (60HZ) output,displayed on HDTV/Monitor,which can bring back your childhood memories.
- Plug to Play: ABLEWE Mini RCA to HDMI converter no extra drivers need, just plug and play,easy to use.Please hook up the USB power cable (included) to 5V power source during use.
- Wide Compatibility: Support source formats of PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV. Provide advanced signal processing with great precision, colors, resolutions, and details.
- Widely Used:Widely applied to PS2,PS3,Xbox,N64, WII, STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- Attention & Package:Please ensure to connect this rca to hdmi converter to power source to make it work.Package include:1*RCA to HDMI Converter,1*usb power cable(adapter not included),1*User Manual.
The project identifies 0.12.6 as its stable series and dates that release June 11, 2020. Its packaging notes describe host-library dependencies, so verify the matching package and runtime on your actual operating system. The age of that stable series is a reason to check whether it meets your production security and compatibility requirements; it does not by itself establish that the software is discontinued.
Troubleshoot common conversion failures
| Symptom | Likely cause | What to check |
|---|---|---|
| PHP cannot start the converter | The executable is missing, not executable by the PHP process, or not on its PATH. | Use the installed binary’s absolute path, check the PHP service user’s permissions, and capture process errors. |
| Conversion exits with an error or creates no file | Bad input/output paths, unwritable output directory, incompatible binary or missing runtime library. | Check the exit code and stderr, verify paths and directory permissions, and install a package matching the host’s architecture and libraries. |
| Output is not a JPG or is empty | Format option or filename mismatch, failed render, or incomplete output. | Set --format jpg or fmt => 'jpg', then confirm the file exists, is non-empty and decodes as an image. |
| Page is blank or missing dynamic content | Scripts or external resources did not finish before capture, or cannot be reached. | Check network access for page assets; increase the PHP delay or use the CLI’s status-wait mechanism when the page provides a reliable ready state. |
| Text is garbled, boxes appear, or glyphs are missing | Encoding mismatch or fonts unavailable in the rendering environment. | Use UTF-8 and install/check the actual fonts and font runtime in the server image; test representative text from your target scripts. |
| Content is clipped or too small | Width, crop or page layout does not match the content. | Adjust screen width and crop, then inspect long localized text and the final image at its real display size. |
| Works locally but fails in production | Different libc, fontconfig, freetype, architecture or package build. | Match the production environment rather than assuming a binary from another distribution will run unchanged; Alpine’s musl base differs from glibc-based systems. |
Or skip the browser setup
If you would rather send a URL and receive an image than install and manage a renderer, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return a JPG by setting the format parameter:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com --data-urlencode format=jpg -o shot.jpg
See the ScreenshotNeo documentation for API options and authentication. It removes cookie/consent banners, newsletter popups and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers indicate the page verdict and whether the shot was billed. Its MCP server offers take_screenshot, get_page_info and capture_pdf for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo free.
Frequently Asked Questions
Does wkhtmltoimage convert a URL as well as a local HTML file?
The documented CLI input is a file or URL input; ensure any URL and its resources are reachable from the conversion host.
What is the default JPEG quality in the PHP wkhtmltox binding?
The PHP manual documents 94 as the default. Set an explicit value when you need predictable configuration.
Quick Recap
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.




