Skip to content

For blob image exports, allow use of canvas.toBlob() where available #2208

Description

@maxkfranz

Issue type

Feature request

Description of new feature

When using image export functions like cy.png(), it would be nice to use canvas.toBlob() if the browser has the function available.

  • Chrome (50+), though mobile may be limited
  • Firefox (25+)
  • Safari, though mobile may be limited
  • Edge (possibly supported, partially supported by canvas.msToBlob())
  • IE (partially supported by canvas.msToBlob()

Note that this would require new API, as canvas.toBlob() is asynchronous, whereas cy.png() and cy.jpg() are synchronous: cy.png({ output: 'blob-promise' })

Motivation for new feature

These items would be nice, but it seems that the browsers don't actually provide these benefits in practice:

  • Faster speed for downloads than using a base 64 export as a intermediary format.
  • Bigger exported images (file size). Base 64 URIs have different size limitations on different browsers.

These items are confirmed benefits:

  • Non-blocking blob generation. This allows for keeping the UI responsive while the download is happening in the background.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions