Method LoadAsRGB
LoadAsRGB(string)
Loads an image from the given file path, applies any necessary path fixes, and returns a new ImageBuffer in RGB24 format.
public static ImageBuffer LoadAsRGB(string path)Parameters
- pathstring
- The file system path to the image file to load. May be a relative or absolute path; invalid segments will be corrected via TryFixPath(string). 
Returns
- ImageBuffer
- An ImageBuffer containing the decoded image data in RGB24 pixel format. 
Exceptions
- ArgumentNullException
- Thrown if - pathis- nullor an empty string.
- FileNotFoundException
- Thrown if no file exists at the corrected - path.
- InvalidOperationException
- Thrown if loading the image from the resulting byte array fails. 
LoadAsRGB(byte[])
Loads image data from the provided byte array and returns a new ImageBuffer in RGB24 format.
public static ImageBuffer LoadAsRGB(byte[] data)Parameters
- databyte[]
- A byte array containing encoded image data (e.g., PNG or JPEG). 
Returns
- ImageBuffer
- An ImageBuffer representing the loaded image. 
Exceptions
- ArgumentNullException
- Thrown if - datais- null.
- ArgumentException
- Thrown if - datais empty.
- InvalidOperationException
- Thrown if loading the image from bytes fails. 
LoadAsRGB(ReadOnlyMemory<byte>)
Loads image data from the provided memory block and returns a new ImageBuffer in RGB24 format.
public static ImageBuffer LoadAsRGB(ReadOnlyMemory<byte> data)Parameters
- dataReadOnlyMemory<byte>
- A ReadOnlyMemory<T> of bytes containing encoded image data. 
Returns
- ImageBuffer
- An ImageBuffer representing the loaded image. 
Exceptions
- ArgumentException
- Thrown if - datais empty.
- InvalidOperationException
- Thrown if loading the image from bytes fails. 
LoadAsRGB(ReadOnlySpan<byte>)
Loads image data from the provided span and returns a new ImageBuffer in RGB24 format.
public static ImageBuffer LoadAsRGB(ReadOnlySpan<byte> data)Parameters
- dataReadOnlySpan<byte>
- A ReadOnlySpan<T> of bytes containing encoded image data. 
Returns
- ImageBuffer
- An ImageBuffer representing the loaded image. 
Exceptions
- ArgumentException
- Thrown if - datais empty.
- InvalidOperationException
- Thrown if loading the image from bytes fails.