Offscreen rendering - Save html as png

929 views
Skip to first unread message

John

unread,
Jul 12, 2016, 3:21:34 PM7/12/16
to Chromium-dev
Is there anyway to render html page to png file ?
If yes, can you please provide a C\C++ example\tutorial

PhistucK

unread,
Jul 12, 2016, 4:05:30 PM7/12/16
to tarion...@gmail.com, Chromium-dev
You should probably look into the Chrome Headless effort. One of their goals is to have a way to get a screenshot for the entire page, if I remember correctly.


PhistucK

On Tue, Jul 12, 2016 at 10:21 PM, John <tarion...@gmail.com> wrote:
Is there anyway to render html page to png file ?
If yes, can you please provide a C\C++ example\tutorial

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Alex Clarke

unread,
Jul 12, 2016, 5:06:33 PM7/12/16
to phis...@gmail.com, Eric Seckler, tarion...@gmail.com, Chromium-dev
+eseckler

I believe basic screen shotting works in headless_lib but we are adding more advanced controls. 

Eric Seckler

unread,
Jul 12, 2016, 5:47:02 PM7/12/16
to Alex Clarke, phis...@gmail.com, tarion...@gmail.com, Chromium-dev
Hi John,

There's a DevTools command, which takes a png screenshot of the rendered page as displayed in a browser window. We use this command to take screenshots in the headless_shell, see HeadlessShell::captureScreenshot(), and we're currently working on adding other controls for size and position of the screenshot area.

Depending on your use case, you can
  1) build and use headless shell ("headless_shell --screenshot https://google.com")
  2) embed headless_lib yourself and call the DevTools command through the C++ bindings (similar to what HeadlessShell does)
  3) or connect to a renderer in a running chrome or headless_shell via the DevTools protocol (use --remote-debugging-port) and issue the command.

Cheers,
Eric
Reply all
Reply to author
Forward
0 new messages