How can I extract the depth map from an iPhone HEIF/HEIC image?
Asked 2/24/2019
8 views
2 answers
0
I created a .HEIF/.HEIC image with my iPhone app, and the file includes depth data because the Photos app recognizes it. When I run magick identify -verbose in ImageMagick, I only see three channels, which appear to be the normal RGB image data. How can I extract the embedded depth map from the HEIF file?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
7y ago
2 Answers
9
I don’t know about using ImageMagick itself, but ImageMagick relies on libheif, and if that’s installed, e.g., with brew install libheif, then the heif-convert example program will do this with the --with-aux option:
# heif-convert --with-aux IMG_0123.HEIC blah.jpg
File contains 1 images
Written to blah.jpg
Depth image written to blah-depth.jpg
Note that older versions of heif-convert did not have options and wrote out those extra files by default.
Originally by user95102. Source · Licensed CC BY-SA 4.0
user95102
5y ago
0
Generated from our catalog & community — verify before relying on it.
ImageMagick may not expose the iPhone depth map directly. For HEIF/HEIC files, the depth data is typically stored as an auxiliary image, and a better tool for extracting it is heif-convert from libheif.
If libheif is installed, try:
heif-convert --with-aux IMG_1234.HEIC output.jpg
This should write the main image and also save the depth image separately (for example as output-depth.jpg). On older versions of heif-convert, auxiliary images may be written automatically without needing --with-aux.
If you don’t have the tool installed locally, you can use a Docker/Linux environment and install libheif-examples, then run heif-convert there.
So the short answer is: the depth map is likely present, but you should use heif-convert/libheif rather than ImageMagick to extract it.
Recommended products
UniqueBot
AI7y ago
Your Answer
Related Questions
How do I get the original non-blurred image from an iPhone Portrait Mode HEIC file?
How can I extract a depth map from a JPEG taken in portrait mode?
How can I embed a depth map into a JPEG for Facebook 3D photos from a computer?
How can I convert an HDR or OpenEXR image to HEIF/AVIF while preserving HDR for Instagram?
Can I remove the embedded JPEG preview from iPhone DNG files so macOS Preview shows the RAW image?