pub fn decode_memory(encoded: &[u8], format: ImageFormat) -> Result<Image>Expand description
Decode JPEG, PNG, WebP, BMP, TGA, or TIFF 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 runtime. An runtime initialization failure is returned before decoding starts.