PHP · HTML to Image

Convert HTML to Image in PHP

Call the renderpix API from PHP using cURL or Guzzle. Works with Laravel, Symfony, WordPress — any PHP project, any hosting environment.

PHPrenderpix API example
<?php

$html = <<<HTML
<div style="padding:48px;background:#0f172a;color:white;
           font-family:sans-serif;border-radius:12px;width:800px">
  <h1>Certificate of Completion</h1>
  <p style="color:#94a3b8">Awarded to: Sarah Johnson</p>
</div>
HTML;

$ch = curl_init("https://renderpix.dev/v1/render");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        "X-API-Key: rpx_your_key",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "html"   => $html,
        "width"  => 800,
        "height" => 400,
        "format" => "png",
    ]),
]);
$image = curl_exec($ch);
file_put_contents("certificate.png", $image);
curl_close($ch);

Common use cases

📜
WordPress plugins
Add image generation to any WordPress plugin or theme.
🛒
WooCommerce
Auto-generate product images from HTML templates.
📋
Laravel jobs
Queue bulk image generation with Laravel's job system.
🖨️
PDF previews
Create print-ready image previews from HTML forms.

Start converting HTML to images for free

100 free renders/month. No credit card. Set up in 2 minutes.

Get free API key