### Is your feature request related to a problem? Please describe.

**HDR (high dynamic range)** is a significant leap forward in image quality on supporting monitors.

One of the challenges is to create an image which shows as an ideal HDR where possible, but safely falls back to showing SDR (standard dynamic range) where not supported. A new "**gain map**" standard (https://helpx.adobe.com/camera-raw/using/gain-map.html) offers this and is already supported by Chrome Canary v116 (including both MacOS / Windows desktop clients and the Android 14 beta). Enable the dev flag for gain maps via **chrome://flags/#gainmap-hdr-images**.

When images are reprocessed (such as by ImageMagick for posting on a Wordpress site via the media library), it is important that the gain map meta data and auxiliary image are retained. And if the image is resized/cropped, the secondary image should be altered in a consistent way.

When a JPG with a gain map is processed with ImageMagick now (ImageMagick 6.9.12-86 Q16 x86_64 17814), the primary image metadata (XMP-hdrgm) is retained, but the secondary image is discarded.

### Describe the solution you'd like

- Metadata and color profile of the base image are retained
- Auxiliary image is retained, including its metadata
- Auxiliary image is rescaled as needed to match any alteration of the primary image. This should be the same percent reduction (as the gain map itself may be at 1/2 or 1/4 resolution of the original to save space in the file).
- Solution should at a minimum support JPG gain maps encoded with an SDR base image (as this offers full backwards compatibility). It should ideally support AVIF gain maps (as this offers much smaller files with AVIF). Gain map support for JXL may be helpful, though the format lacks critical support to be important in the foreseeable future.

### Describe alternatives you've considered

Direct posting of the image without support for derivative assets like thumbnails or use of the media library. This could broadly affect a wide range of sites managing such images, so lack of support is very limiting and would require exporting multiple versions of images (if the platform even supports bypassing asset management which may reprocess the file).

### Additional context

See https://gregbenzphotography.com/hdr/ for examples, monitor tests, and more info on HDR images.

See https://helpx.adobe.com/camera-raw/using/gain-map.html for sample gain map images in JPG, AVIF, and JXL formats.
 
Add support for HDR gain maps
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Add support for HDR gain maps
Issue date:

--- start body ---
### Is your feature request related to a problem? Please describe.

**HDR (high dynamic range)** is a significant leap forward in image quality on supporting monitors.

One of the challenges is to create an image which shows as an ideal HDR where possible, but safely falls back to showing SDR (standard dynamic range) where not supported. A new "**gain map**" standard (https://helpx.adobe.com/camera-raw/using/gain-map.html) offers this and is already supported by Chrome Canary v116 (including both MacOS / Windows desktop clients and the Android 14 beta). Enable the dev flag for gain maps via **chrome://flags/#gainmap-hdr-images**.

When images are reprocessed (such as by ImageMagick for posting on a Wordpress site via the media library), it is important that the gain map meta data and auxiliary image are retained. And if the image is resized/cropped, the secondary image should be altered in a consistent way.

When a JPG with a gain map is processed with ImageMagick now (ImageMagick 6.9.12-86 Q16 x86_64 17814), the primary image metadata (XMP-hdrgm) is retained, but the secondary image is discarded.

### Describe the solution you'd like

- Metadata and color profile of the base image are retained
- Auxiliary image is retained, including its metadata
- Auxiliary image is rescaled as needed to match any alteration of the primary image. This should be the same percent reduction (as the gain map itself may be at 1/2 or 1/4 resolution of the original to save space in the file).
- Solution should at a minimum support JPG gain maps encoded with an SDR base image (as this offers full backwards compatibility). It should ideally support AVIF gain maps (as this offers much smaller files with AVIF). Gain map support for JXL may be helpful, though the format lacks critical support to be important in the foreseeable future.

### Describe alternatives you've considered

Direct posting of the image without support for derivative assets like thumbnails or use of the media library. This could broadly affect a wide range of sites managing such images, so lack of support is very limiting and would require exporting multiple versions of images (if the platform even supports bypassing asset management which may reprocess the file).

### Additional context

See https://gregbenzphotography.com/hdr/ for examples, monitor tests, and more info on HDR images.

See https://helpx.adobe.com/camera-raw/using/gain-map.html for sample gain map images in JPG, AVIF, and JXL formats.
 
--- end body ---

None