code wiki / (root) / nx_image_load_raw.nx

nx_image_load_raw.nx

buildroot/runtime/nx_image_load_raw.nx

4264 B118 linesdepth 5pulls 6 transitivereach 2 importersview sourcekind librarytopic image
docsdependenciesstructsconstsfunctions

about

nx_image_load_raw.nx -- load real images via raw-binary header + pixels. The substrate bridges to real images via a SIMPLE raw format that any preprocessor (PIL, ImageMagick, ffmpeg, custom script) can produce: bytes 0..7 width (little-endian i64) bytes 8..15 height (little-endian i64) bytes 16..23 channels (little-endian i64) bytes 24.. raw pixel data, row-major, width * height * channels bytes This is the LAST-MILE primitive — once it lands, nx_color_skin_mask / nx_region_segment / nx_eye_detect / etc all consume real PNG renders via this conversion bridge: # Python preprocessing (svc-quality does this once per image): import struct, PIL.Image, numpy as np arr = np.array(PIL.Image.open(path).convert("RGB")) h, w, c = arr.shape with open("/tmp/img.raw", "wb") as f: f.write(struct.pack("<QQQ", w, h, c)) f.write(arr.tobytes()) # nxc2-compiled detector reads /tmp/img.raw, runs the full pipeline, # writes verdict.json. svc-quality reads verdict.json, emits to UI.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_image.nx nx_image_load_raw.nx nx_image_load_raw_test.nx nx_quality_driver.nx

imports: nx_syscalls.nxnx_image.nx

imported by: nx_image_load_raw_test.nxnx_quality_driver.nx

structs

none

consts

none

functions

36func nx_image_load_read_i64_le(buf: *u8, offset: i64) -> i64
50func nx_image_load_raw(path: *u8) -> *Image
79func nx_image_save_raw_pack(img: *Image, out_buf: *u8) -> i64
called by 1: main