Table of Contents

Method Load

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

Load(string)

Loads an image from a file path, preserving its native pixel format. Grayscale images are loaded as GRAY8, images with alpha as RGBA32, and all others as RGB24.

public static ImageBuffer Load(string path)

Parameters

path string

The file path to load the image from.

Returns

ImageBuffer

An ImageBuffer representing the loaded image in its native pixel format.

Exceptions

ArgumentNullException

Thrown if path is null or empty.

FileNotFoundException

Thrown if the file does not exist.

InvalidOperationException

Thrown if loading fails.

Load(byte[])

Loads image data from a byte array, preserving the native pixel format.

public static ImageBuffer Load(byte[] data)

Parameters

data byte[]

A byte array containing encoded image data (e.g., PNG or JPEG).

Returns

ImageBuffer

An ImageBuffer in the most appropriate pixel format for the source image.

Exceptions

ArgumentNullException

Thrown if data is null.

ArgumentException

Thrown if data is empty.

InvalidOperationException

Thrown if loading fails.

Load(ReadOnlyMemory<byte>)

Loads image data from a memory block, preserving the native pixel format.

public static ImageBuffer Load(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

A ReadOnlyMemory<T> of bytes containing encoded image data.

Returns

ImageBuffer

An ImageBuffer in the most appropriate pixel format for the source image.

Exceptions

ArgumentException

Thrown if data is empty.

InvalidOperationException

Thrown if loading fails.

Load(ReadOnlySpan<byte>)

Loads image data from a span, preserving the native pixel format.

public static ImageBuffer Load(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

A ReadOnlySpan<T> of bytes containing encoded image data.

Returns

ImageBuffer

An ImageBuffer in the most appropriate pixel format for the source image.

Exceptions

ArgumentException

Thrown if data is empty.

InvalidOperationException

Thrown if loading fails.

Share