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

Encoding 16 bit floating point data to BT.2100 PQ PNG file #40

Open
hybridherbst opened this issue Jun 26, 2024 · 1 comment
Open

Encoding 16 bit floating point data to BT.2100 PQ PNG file #40

hybridherbst opened this issue Jun 26, 2024 · 1 comment

Comments

@hybridherbst
Copy link

Hey, I'm trying to figure out if one of the available PNG libraries is flexible enough to let me write HDR – BT.2100 PQ PNG files in the browser, coming from 16-bit floating point data (such as captured from a WebGL render target).

Here's an example of such a file – on Chrome on MacOS/Windows with a HDR display it will display in HDR in the browser:

lonely_road_afternoon_puresky_1k2

And here's example input (in EXR) for such a file:
lonely_road_afternoon_puresky_1k.exr.zip

@targos
Copy link
Member

targos commented Jun 28, 2024

Hello, it's possible to encode data from a Uint16Array using:

encode({
  width: imageWidth,
  height: imageHeight,
  data: imageDataUint16,
  depth: 16
  channels: numberOfChannels // (4 if RGBA data)
});

If I understand correctly, https://www.w3.org/TR/png-hdr-pq/ is the spec we would need to implement for the HDR format. I'm not sure if it's enough to add the new chunks or if the data needs to be transformed too.

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

No branches or pull requests

2 participants