Skip to content

Please add support for HDR JPG gain maps #4314

@gregbenz

Description

@gregbenz

Feature request

What are you trying to achieve?

Add support for transcoding JPG gain maps. These images enable the ability to share images edited for modern displays that support HDR (high dynamic range). And compared to HDR-only encoding, using a gain map allows the image to be properly adapted to any display which does not support the full HDR encoding. That adaptation is critical to being able to safely share HDR images on any display - including SDR ("standard dynamic range") and monitors with limited HDR capabilities.

These HDR displays are already more common than generally known. Roughly 80% of viewers on Instagram already have HDR support and you can see examples of HDR vs standard images in my Instagram feed in the IG phone app (or using Chrome with an M1+ MacBook Pro).

When you searched for similar feature requests, what did you find that might be related?

There is a request for JXL support (#4263). While that is a great format, JPG (and AVIF) with a gain map is more practical. The JPG format is 100% backwards compatible and already widely supported. The AVIF gain map encoding will be very important and already has support in Adobe software and Chrome. We're probably a year away from having enough critical support to use AVIF, but there is clear and steady progress towards that point. There is little support for JXL and it is unclear if it will gain acceptance on the web (especially as Chrome removed support).

What would you expect the API to look like?

Should support simple transcoding of JPG (crop, resize, compress) while retaining the HDR. That means the base image and auxiliary gain map should be edited in a consistent manner, and the HDR metadata should be retained.

The Google-backed open-source libultrahdr library already supports all of this. All that is needed is some integration with libvips.

What alternatives have you considered?

There is a request for libvips to add support: libvips/libvips#3799

Please provide sample image(s) that help explain this feature

More info on HDR and gain maps.

Here is a sample image. The image will tell you if you are viewing just the SDR base image, or viewing as HDR (when using a supported browser and display, you should see blue text). The image is encoded with both the ISO and Android XMP standards (the ISO encoding is really all that is needed, the XMP encoding is redundant for backwards compatibility, but won't be important for too long).
Image

Developer resources for gain maps: https://gregbenzphotography.com/hdr/#developers

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions