1

Does there exist a tool that can render HTML code to an image file? I'm writing a scifi novel and I have an idea to include images of social media threads as chapter headings. I have some experience with web development, and I want to create my own version of Twitter for the story (it can't actually be twitter since the story is set a couple centuries in the future).

A while back I looked for Chrome extensions that could do something like this, and I found several that take screenshots. I was dissatisfied with this solution because (if I'm remembering correctly) I had to scroll my webpage up and down to get the whole thing as one screenshot. The dimensions of the resulting image were inconsistent and completely tied to my input. The whole procedure was undesirable since I might need to suddenly revise the text of these social media comments, reload my website in Chrome, and use the extension to screenshot.

What I'm envisioning instead is something like a command line tool where I specify the path to an index.html. The tool would start up the website, draw all of it to a PNG image in some directory, and then finish. I imagine that it would be built on top of the v8 javascript engine.

I would prefer something that can handle an entire JS framework such as vue, but I will settle for anything that does html and css. Does such a tool exist or am I stuck using screenshots?

2 Answers 2

1

This creates /tmp/output.png as an image of the given web page:

$ google-chrome --headless --screenshot=/tmp/output.png https://en.wikipedia.org

Is that what you're trying to do?

1
  • Would this work with Chromium, too?
    – jmizv
    Aug 7, 2023 at 11:51
0

I think that API Flash should do what I need. https://apiflash.com/

The downside is that I will need to deploy my websites somewhere, probably as static sites in AWS s3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.