Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Allow colorSpace attributes in getImageData and toDataURL #19

@bensyverson

Description

@bensyverson

It would be a very useful convenience if users could request image data in a target color space / configuration. This impacts both getImageData and toDataURL.

Example use cases:

  • The user has a wide gamut display, so we use a rec2020 Canvas for drawing, but we need to generate an sRGB snapshot for social media.
  • We're compositing in linear half float, but we need to read out clamped 8 bit data for use as a WebGL texture.
  • The user wants to "eyedropper" the color from a deep color Canvas at an arbitrary place, and see the results as both a color(p3, 1, 0, 1) declaration and an sRGB #ff00ff hex code.

Currently the workflow would be to use the drawImage method to draw the canvas into another canvas in the destination colorspace, but that's rather inelegant.

And of course, toDataURL would need to start tagging the destination ICC profile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions