Skip to content

"Screenshot" canvas cells faster #19

@asg017

Description

@asg017

notebook.screenshot uses ElementHandle.screenshot under the hood, which is slow but necessary is many cases. But, if the cell that want's to be screenshot is already a canvas, then calling .toDataURL() and passing that base64 string back to node would be much faster, I think.

So new screenshot algo would be:

  1. Get the cell's element handle
  2. If it is a canvas element, then get the data url, pass back to node, then covert to buffer/write as a png/jpeg/whatever manually.
  3. Else use ElementHandle.screenshot and suffer

To be sure, need to benchmark how fast .screenshot is currently, and how much faster .toDataURL() would be. Might as well throw .svg() and .html() benchmarking in here too to compare.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions