gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.06k stars 7.54k forks source link

Image processing strips out HDR data #12781

Open timcappalli opened 3 months ago

timcappalli commented 3 months ago

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:

cmahnke commented 3 months ago

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 commented 3 months ago

Some notes from me:

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