Description
Discussed in #3798
Originally posted by cromefire December 24, 2023
Ultra HDR is Google's new HDR image format based on JPEG and GainMaps (for compatibility) and newer Pixels actually produce Ultra HDR photos by default now (it's pretty cool!)
But the problem is right now libvips is running into that mentioned compatibility mode, where it's taking the primary image and discarding the GainMap, so any image ever processed by libvips looses its HDR and becomes SDR only (it does copy the metadata already so it's identified as Ultra HDR, but it doesn't work).
Here's some random Ultra HDR image I use for testing (it's a screenshot originally at up to 1000nits, so the HDR isn't limited by the camera):
Here it is copied (vips copy
):
Here it is flipped (vips flip
):
I hope GitHub doesn't modify them (nope looks good on my phone), because in that case the first one should be HDR on an HDR display using Chrome (Desktop and Android) and then you can just download and inspect them, otherwise I'll just upload them as a zip. And that's the exact problem I'm basically facing. Because as soon as Nextcloud for example (which uses Imaginary, which uses bimg, which uses libvips) touches them, it immediately looses the HDR layer.
That would be the first step, which should probably not require any API changes, the second one (which I don't have any use for right now as I don't build directly on this library but could be pretty useful in the future) would probably be to support Ultra HDR conversion to other formats directly using libultrahdr using that you could conceivably convert an Ultra HDR image to an HDR AVIF, JXL or HEIC (or JXR for Windows because they don't seem to support anything else...) image.