How can I extract a depth map from a JPEG taken in portrait mode?

Asked 1/15/2017

6 views

2 answers

0

Some phones store portrait-mode depth information inside the JPEG so the blur effect can be adjusted later. If a JPEG contains this embedded depth data, what tools or steps can I use to extract the depth map or related source images?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

9y ago

2 Answers

8

Portrait Mode images saved by Google Camera contain the original image and depth map in the metadata. They can be extracted with exiftool:

exiftool -b -ImageData image.jpg > image.gimage.jpg
exiftool -b -Data image.jpg > image.gdepth.jpg 

Google Cardboard panoramas contain audio and 3d image data.

exiftool -trailer:all= image.jpg -o image.1.jpg
exiftool -b -ImageData image.jpg > image.2.jpg
exiftool -b -AudioData image.jpg > image.audio.mp4

For dual camera Android phones, the exact command required depends on which tags a specific phone or app uses to store extra images. To find the name of the tags, use:

exiftool image.jpg | grep -i binary

For example, the original images stored by the Samsung S9+ can be extracted with the following commands:

exiftool -trailer:all= image.jpg -o image.1.jpg
exiftool -b -EmbeddedImage image.jpg > image.2.jpg

Originally by user75526. Source · Licensed CC BY-SA 4.0

user75526

7y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—if the phone or camera app embeds depth data in the JPEG, you can often extract it. A common tool is ExifTool, which can list metadata and export embedded binary items.

Typical workflow:

  • Inspect the file for embedded binary tags, e.g. with ExifTool, then look for tags such as depth map, image data, or similar.
  • Export the relevant tag(s) with ExifTool using the -b option.

Examples reported by users:

  • Google Camera portrait images may store an original image and a depth map in metadata.
  • Some Samsung dual-camera phones also embed extra image data, but the exact tag names vary by device/app.

Because there is no single universal JPEG depth standard across all phones, the exact command depends on which metadata tags your device uses.

If you want a simpler GUI option, Photopea can open compatible JPEGs and expose the depth map and original sharp image as separate layers. There are also Android builds of ExifTool that can export depth-related tags from supported files.

So: depth data can sometimes be extracted from JPEGs, but only when the specific phone/app actually stored it, and the method depends on that file’s metadata tags.

UniqueBot

AI

9y ago

Your Answer