hdr-canvas 0.1.0 published

hdr-canvas version 0.1.0 released…

One result of my work with HDR content in the browser is an NPM module, which was also used to create the posts in this blog. However, about a year has passed since the first versions and the browser API was rather experimental at that time. A lot has changed since then - one of the examples had even stopped working in the meantime: The most important change concerns the change from Uint16 to Float16 as 16 bit pixel data type for HDR.

Since browsers are developing rapidly and the use of older browsers is not recommended for security reasons (even if some people see it differently), no downward compatibility is to be expected.

In addition to the necessary adjustments, the new version also offers improvements in the area of documentation and examples.

The code can be found on GitHub and NPM.

The release notes

Introduction

Since the last release many areas of handling HDR contet in the browser have evolved. Most notably is certainly the introduction of the Float16Array in the ImageData construtor:

As @reitowo pointed out, there has been a change to the getContext("2d") method. The key pixelFormat has been replaced by colorType.

In parallel threre have been changes to the UltraHDR image format, especially te encoding of gain map matadata. While this used to be don in XMP it’s now done according to ISO 21496-1. This ihas been adopted by Google and Apple in newer OS versions like Android 15 and iOS 18 to avoid cross-platform fragmentation. The UltraHDR Library has already changed to ussin the ISO format as default.

Currently the ThreeJS UHDR loader doesn’t know how to handle this change, see mrdoob/three.js#32293.

Key Changes & New Features

  • Better support for official Web-APIs
    • Use Float16Array instead of Uint16Array
    • Use the correct option for initializing 2D canvas context

Improved Documentation

The documentation have been greatly improved, there is now also a site including the examples and API docs.

Examples

The examples from this blog are now part of this repository:

These example are also avalable on the new documentation site

Advocacy

Since the changes by the WhatWG weren’t picked up already there had to be some Issues in the relevant repos to be raised.