Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify expectactions for toDataURL() and toBlob() #125

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

palemieux
Copy link
Contributor

Closes #119

@palemieux palemieux self-assigned this Jun 20, 2024
@@ -162,6 +162,10 @@ not quantized, i.e. R' = 0.5 is represented by the floating point value 0.5.
_NOTE: `dataType = "unorm8"` corresponds to HTML Canvas as it exists today and
should not be used to represent HDR signal, as detailed in the introduction._

The `HTMLCanvasElement` methods `toDataURL()` and `toBlob()` should produce
resources that best match the fidelity of the underlying HTML Canvas element
(subject to the limitations of the implementation and the requested format).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems a bit vague, hand-wavy and hard to test.

It seems better to crisply state that the color space of the 2D context should be preserved in toDataURL() and toBlob(). (And yes, if the requested format can't do that then there is an issue, but all common formats can represent that information).

Copy link
Contributor

@svgeesus svgeesus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really respond to the TAG issue as it is too vague (and I don't see a reason for the vagueness). Currently, a Canvas 2D context is either sRGB or Display P3 and that info is easy to persist (for example using CICP).

@palemieux
Copy link
Contributor Author

palemieux commented Jun 20, 2024

How can it be made less vague without providing a specific mapping to each format, which the Web Platform does not do today?

@svgeesus
Copy link
Contributor

How can it be made less vague

By explicitly stating that the color space of the Canvas context should be preserved, rather than vaguely mentioning "fidelity"

without providing a specific mapping to each format, which the Web Platform does not do today?

The mechanism by which each format does this need not be specified in detail. There are two common cross-format methods in use and my suggested text mentions both as examples.

palemieux and others added 2 commits June 20, 2024 15:10
@svgeesus svgeesus merged commit 7f3e04c into main Jun 20, 2024
@svgeesus svgeesus deleted the issues/0119-to-blob-clarification branch June 20, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is the color space preserved during toBlob() and toDataURL()
2 participants