How can I incorporate HDR gain map from JPEG / HEIC? #3153
AttilaTheFun
started this conversation in
Help wanted
Replies: 3 comments 3 replies
|
Hi @AttilaTheFun, I think libvips can read gain maps out of HEIC images -- just set the |
0 replies
|
Hi @jcupitt ! This is one of the sample images provided with iOS simulators: As you can see in this screenshot, iOS recognizes it as an HDR image even though it's only 8-bit. |
3 replies
|
Initial support for HDR JPG with gain maps in libvips: #4645 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
The iPhone for many years has had a "Smart HDR" feature which created "fake" HDR images by storing a HDR gain map in the image metadata of HEIC and JPEG images.
There is some discussion here about how to read / write these gain maps on iOS here:
https://gist.github.com/kiding/fa4876ab4ddc797e3f18c71b3c2eeb3a
I would like to read out this gain map and incorporate it with the image data using vips to create a true HDR image, and then save it out to a format that natively supports it like AVIF.
It sounds pretty straightforward to extract the gain map as a bitmap, but I'm not sure the best way to apply this to the vips image.
From that thread users suggested using a YCbCr color space and then multiplying the Y components by the bitmap values. I'm not sure how I would do that with vips though.
All reactions