with jpeg format, I know can use:
exiftool -b -MPImage2 test-lumen.jpg > depthMap.jpg
But if the format is Heic, there is any method can export the HDR gain Map?
You can install (libheif) and do:
heif-convert <source_file>.HEIC <result_file>.jpg
It will save auxiliary images as well.
You need to be able to extract Apple specific metadata first.
It's documented here:
https://developer.apple.com/documentation/appkit/images_and_pdf/applying_apple_hdr_effect_to_your_photos
You can install (libheif) and do:
heif-convert <source_file>.HEIC <result_file>.jpg
It will save auxiliary images as well.