Spatial Photos.

3D from any image, web-ready and interactive.

What is a
Spatial Photo?

A Spatial Photo is a still image you can view from slightly different positions. The foreground shifts against the background, giving it a sense of depth.

Spatial Photos uses Apple’s ML-SHARP to estimate a 3D scene from one image, then saves it as a compact .spatial file for the web.

File format

Quickstart

Documentation
  1. 01

    Install

    Clone the project and install the dependencies. Requires Python 3.11+ and a C++20 compiler.

    Terminal
    git clone --recurse-submodules https://github.com/frozein/SpatialPhotos.git
    cd SpatialPhotos
    python3 -m venv .venv
    source .venv/bin/activate
    python -m pip install -e ./ml-sharp rectpack ninja
    python -m ddgs_cpu

    On Windows, use python instead of python3 and activate with .venv\Scripts\activate.bat in a Visual Studio Developer Command Prompt.

  2. 02

    Generate

    Choose an image. The model checkpoint (about 2.8 GB) downloads automatically on first use.

    Terminal
    python predict.py input.jpg output.spatial
  3. 03

    View your photo

    Open your .spatial file to preview it.

    Download an example

    Your file stays on your device.

  4. 04

    Embed

    Install and import the web component, then set its size with CSS.

    Terminal
    npm install spatial-photos
    JavaScript + HTML
    import 'spatial-photos';
    
    <spatial-photo
      src="/output.spatial"
      style="width: 100%; height: 480px"
    ></spatial-photo>