Convert your HTML to images with Cloudflare Browser Rendering and R2 storage.
Converts HTML to image and stores it in R2.
{
"html": "<html>...</html>",
"filename": "my-image", // without extension
"options": {
"width": 1200,
"height": 800,
"format": "png", // png or jpeg
"quality": 90, // for jpeg only
"fullPage": false,
"deviceScaleFactor": 2,
"waitTime": 1000 // milliseconds
}
}
Retrieves an image stored in R2.
// Convert HTML to image
const response = await fetch('https://html-images.axazara.cloud/convert', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
html: `
<html>
<body style="padding: 40px; background: linear-gradient(to right, #667eea, #764ba2);">
<div style="background: white; padding: 30px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);">
<h1 style="color: #333; font-family: Arial;">My Document</h1>
<p style="color: #666;">This is an example of HTML to image conversion.</p>
</div>
</body>
</html>
`,
filename: "my-document",
options: {
width: 800,
height: 400,
format: 'png'
}
})
});
const result = await response.json();
console.log('Image URL:', result.url);