Realm

Viewer Image Headless

Runnable OA SDK tutorial.

Python

Example

This example is currently documented in Python only.

Tu_viewer_image_headless.py

1"""Decode and save a semantic image without a window.
2
3Usage: python sdk/py/tutorials/vision/tu_image_headless.py [input] [output]
4"""
5
6import sys
7
8import oa
9
10
11source = sys.argv[1] if len(sys.argv) > 1 else "sdk/asset/image/coverMl.jpg"
12output = sys.argv[2] if len(sys.argv) > 2 else "/tmp/oa_viewer_headless.png"
13image = oa.image.decode_file(source, "rgba", None)
14oa.image.save_file(output, image)
15print(f"wrote {output}")
16

Run Rust tutorials from the OA SDK checkout with cargo run --release --example <name>. Run Python with the environment containing the OA native extension. Consult each program's arguments and capability checks before running it.