HTML to PNG
Renders an HTML snippet (Tailwind classes work) as an 800×600 PNG.
Input
{
"height": 600,
"width": 800,
"outputFormat": "png",
"html": "<div class='flex flex-1 bg-gray-300 rounded-md'><div class='flex flex-col md:flex-row w-full py-12 px-4 md:items-center justify-between p-8'><h2 class='flex flex-col text-3xl sm:text-4xl font-bold tracking-tight text-gray-900 text-left'><span>Hello {{ name }}</span><span class='text-indigo-600'>Welcome to 1001fx</span></h2><div class='mt-8 flex md:mt-0'><div class='flex rounded-md '><div class='flex items-center justify-center rounded-md border-transparent bg-indigo-600 px-5 py-3 text-base font-medium text-white'>Get started</div></div><div class='ml-3 flex rounded-md '><div class='flex items-center justify-center rounded-md border-transparent bg-white px-5 py-3 text-base font-medium text-indigo-600'>Learn more</div></div></div></div></div>"
}Output · HTTP 200
{
"statusCode": 200,
"headers": {
"content-type": "image/png"
}
}Show curl command
curl -X POST 'https://api.1001fx.com/images/html2image' \
-H 'X-API-KEY: YOURSECRETAPIKEY' \
-H 'Content-Type: application/json' \
-d '{"height":600,"width":800,"outputFormat":"png","html":"<div class='\''flex flex-1 bg-gray-300 rounded-md'\''><div class='\''flex flex-col md:flex-row w-full py-12 px-4 md:items-center justify-between p-8'\''><h2 class='\''flex flex-col text-3xl sm:text-4xl font-bold tracking-tight text-gray-900 text-left'\''><span>Hello {{ name }}</span><span class='\''text-indigo-600'\''>Welcome to 1001fx</span></h2><div class='\''mt-8 flex md:mt-0'\''><div class='\''flex rounded-md '\''><div class='\''flex items-center justify-center rounded-md border-transparent bg-indigo-600 px-5 py-3 text-base font-medium text-white'\''>Get started</div></div><div class='\''ml-3 flex rounded-md '\''><div class='\''flex items-center justify-center rounded-md border-transparent bg-white px-5 py-3 text-base font-medium text-indigo-600'\''>Learn more</div></div></div></div></div>"}'