Live data from Hacker News

Show HN: Turn raw HTML into production-ready images for free

html2png.dev

21–30 of 87 posts

Re: Show HN: Turn raw HTML into production-ready images for free

#21
that "Not MCP" is so refreshing it makes me laugh out loud

it's literally waht i've been saying all along when I came across mcp "why can't i just give agent a prompt and it will run the rest api calls for me"

there's still some MCPs which makes sense but we have it for literally everything when just a prompt will do the job!

now on the topic of html2png i do wonder is this like the self-hostable version on github https://github.com/maranemil/HTML2Png where they use canvas? or is this something else ?

Re: Show HN: Turn raw HTML into production-ready images for free

#22
post #14
post #12

I’m afraid out of all the waiting strategies available in Puppeteer/Playwright, waiting a fixed period is the worst possible. Maybe consider exposing the proper waiting strategies, load/domcontentloaded/networkidle, maybe even the more fine-grained ones https://playwright.dev/docs/actionability

I did some tests and it didn't seem like a fixed wait, when I kept making network requests the render timed out entirely.

I made the comment based on the delay parameter (“Wait time in ms.”) in the API. I didn’t test so don’t know what the default behavior is.

Re: Show HN: Turn raw HTML into production-ready images for free

#24
post #15

This is cool! One use case is generating a Mermaid diagram as an image. For example, you can use the following HTML[^1]: graph LR A --- B B-->C[fa:fa-ban forbidden] B-->D(fa:fa-spinner); import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs'; Then html2png.dev will serve you: https://html2png.dev/api/blob/oTVGhhCc6rDZYQFDIE3EGkcKs-KO6J9-_DHs-jO2OJc-d23fb4f2.png [^1]: https://mermaid.js…

Why wouldn’t you just use Mermaid to generate the PNG directly?

One reason I could think of: Fewer dependencies that need integration

Re: Show HN: Turn raw HTML into production-ready images for free

#25
post #8

Very cool. Is there an option to self-host? This seems like it could be a cool agent skill.

HTML to PNG:

    chromium --headless --disable-gpu --screenshot=output.png --window-size=1920,1080 --hide-scrollbars index.html
Also works great for HTML to PDF:

    chromium --headless --disable-gpu --no-pdf-header-footer --run-all-compositor-stages-before-draw --print-to-pdf=output.pdf index.html

Re: Show HN: Turn raw HTML into production-ready images for free

#26
post #9

What differentiates production-ready images from regular images?

They're bedazzled by a little bit of marketing flair. Generally I find production-ready images have more synergy and tend to be web-scale. Often they're built from the ground up for AI & are blazing fast, at scale, and empower your team whilst unlocking new possibilities. As my sibling comment suggests, being cloud-native is a crucial factor too.

Downvoted for not starting with "Great question!" /s
Post reply on HN