Method LoadAsRGB
LoadAsRGB(string)
Loads an image from the given file path, applies any necessary path fixes, and returns a new ImageBuffer in RGB format.
public static ImageBuffer LoadAsRGB(string path)
Parameters
path
stringThe 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 RGB pixel format.
Exceptions
- ArgumentNullException
Thrown if
path
isnull
or 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 RGB format.
public static ImageBuffer LoadAsRGB(byte[] data)
Parameters
data
byte[]A byte array containing encoded image data (e.g., PNG or JPEG).
Returns
- ImageBuffer
An ImageBuffer representing the loaded image.
Exceptions
- InvalidOperationException
Thrown if loading the image from bytes fails.