hugo icon indicating copy to clipboard operation
hugo copied to clipboard

Image processing strips out HDR data

Open timcappalli opened this issue 1 year ago • 2 comments

What version of Hugo are you using (hugo version)?

hugo v0.132.1+extended darwin/arm64 BuildDate=2024-08-13T10:10:10Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes

Description

The image processing functions of Hugo seem to strip out the necessary metadata to display an image with High Dynamic Range (HDR).

When I open the source image in Google Chrome, the image shows correctly in HDR. When I view the same image on a site generated from Hugo, it is displayed normally / SDR.

I'm not an HDR expert, but from what I understand, Google's Ultra HDR (used with Pixel phones) stores the HDR data in XMP metadata in the image. I believe there are also "Gain Maps" embedded in the image.

Additional Info

Here is a source image you can test with: test image

This is from Gemini:

  • Android's Ultra HDR Image Format: This format uses XMP metadata to define multiple images and their relationship to create the HDR image. Details
  • XMP Metadata: A common method for storing additional data in images is using XMP (Extensible Metadata Platform) metadata. This allows for the storage of structured information within the image file.
  • Gain Maps: Some HDR formats use gain maps to represent the difference between the HDR image and a standard dynamic range (SDR) image. This information is embedded alongside the main image data.

timcappalli avatar Aug 17 '24 16:08 timcappalli

thanks for raising this, there are currently many efforts in implementing UltraHDR support into image processing frameworks, like Python Pillow, LibVips, ImageMagick and various HDR image viewers. The usual approach is to integrate libultrahdr, but this is certainly not the route Hugo want's to take. Since it's a C / C++ library. But this might be a good starting point to raise an issue with a Golang imaging library or even the one provided by default...

Here is the documentation of the format. In short: I's a MPO JPEG (Multi Picture Object) which uses XMP to reference the gainmap, this is a (usually) downsampled image used to indicate which areas of an image should have higher brightness ...

cmahnke avatar Aug 17 '24 18:08 cmahnke

Some notes from me:

  • Hugo (mostly) uses the image encoders in Go.
  • None of them support any metadata.
  • We have a new image metadata library that can read XMP.
  • It's unlikely that I want to take the route of implementing metadata writing myself, as that would take too much time.

That said, I'm pretty interested in photography (currently with a Sony A7r IV), but not so much into HDR ... But that may change.

bep avatar Aug 17 '24 18:08 bep

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

github-actions[bot] avatar Aug 18 '25 02:08 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 04 '25 02:11 github-actions[bot]