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

Image processing strips out HDR data #12781

Open
timcappalli opened this issue Aug 17, 2024 · 2 comments
Open

Image processing strips out HDR data #12781

timcappalli opened this issue Aug 17, 2024 · 2 comments

Comments

@timcappalli
Copy link

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.
@cmahnke
Copy link

cmahnke commented Aug 17, 2024

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 ...

@bep
Copy link
Member

bep commented Aug 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants