Is there an Elixir HTML to image converter

I’m looking to convert HTML to images. What library can I use?

Uh, in what way? Are you wanting to write syntax-colored HTML to an image for display? Are you wanting to run and execute javascript on html with css and all via a full renderer and save the page to an image? Something in-between? The latter is an exceptionally hard task and would probably involve calling out to an external chromium/firefox process to have it do it or so.

You might be able to use Hound if you want to take screenshots from HTML documents. This is an Elixir wrapper around Webdriver. While it is mainly built for testing, it might be able to take screenshots as well.

1 Like

I have a text editor with limited rich text file functionality. I want to be able to save that text into an image of fixed canned sizes for posting on Facebook etc. for unique fonts And styling.
I have option of limiting support to few formatting tags. Do you think I need a full fledged renderer for that? I saw a few HTML to PDF libraries for Elixir, so thought this might be available too.

If You can save Your HTML to file than You can use PhantomJS +rasterize.js to convert it to PDF or image. wkhtmltoimage could also work. All these are command line tools so You can start them via Porcelain or System.cmd/3. I think You can also “flow” Your HTML data directly to wkhtmltoimage using Porcelain, and a - as command line parameter

1 Like