Skip to content

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true #2986

@MikkiSolid

Description

@MikkiSolid

Bug reports:

I repeatedly call

await html2canvas(item, option)
    .then(canvas=>
    {
        let img = canvas.toDataURL("image/png");
        ...
    })

and I see warnings in the browser console: "Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently"
the warning refers to the line

clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);

how to solve the problem with warnings?
Thank you in advance :)

Specifications:

  • html2canvas version tested with: v1.4.1
  • Browser & version: Google Chrome v107.0.5304.88
  • Operating system: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions