Realm

oa::image::decode_memory

Decode JPEG, PNG, WebP, BMP, or TGA bytes and upload normalized planar FP32 pixels. The requested output format may be Gray, Rgb, or Rgba. The result is one NCHW image shaped [1, channels, height, width]. Errors Returns an error for empty, unsupported, or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure. This variant decodes on this thread’s default engine. An engine initialization failure is returned before decoding starts.

FnRust public API

Function Documentation

pub fn decode_memory( encoded: &[u8], format: ImageFormat ) -> Result<Image>
Decode JPEG, PNG, WebP, BMP, or TGA bytes and upload normalized planar FP32 pixels. The requested output format may be Gray, Rgb, or Rgba. The result is one NCHW image shaped [1, channels, height, width]. Errors Returns an error for empty, unsupported, or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure. This variant decodes on this thread’s default engine. An engine initialization failure is returned before decoding starts.