Class ImageBuffer
Represents an unmanaged image buffer for pixel data, providing methods to load, save, and manipulate images.
public sealed class ImageBuffer : IDisposable
- Inheritance
-
ImageBuffer
- Implements
- Inherited Members
Properties
- Buffer
Gets a pointer to the raw pixel buffer.
- BufferLength
Gets the total length, in bytes, of the pixel buffer.
- Format
Gets the pixel format of the image.
- Height
Gets the height of the image in pixels.
- PixCount
Gets the total number of pixels in the image.
- Scan0
Gets a pointer to the first scan line of the image, taking into account the stride direction.
- Stride
Gets the number of bytes in a single row (scan line) of the image.
- Width
Gets the width of the image in pixels.
Methods
- Clone()
Creates a deep copy of this image buffer.
- Dispose()
Releases all resources used by this ImageBuffer.
- GetResizedImage(int, int)
Resizes the image to the specified dimensions, without preserving the aspect ratio.
- GetResizedImageBox(int, int, int)
Resizes the image to fit within the specified box, adding padding with the given background color to preserve aspect ratio.
- GetRotatedImage(int)
Rotates the image by the specified angle. Only 90, 180 or 270 degrees clockwise are supported.
- GetScanLine(int)
Returns a pointer to the beginning of the specified scan line.
- Invert()
Inverts each byte in the image buffer (per channel bitwise NOT) for RGB images.
- LoadAsRGB(byte[])
Loads image data from the provided byte array and returns a new ImageBuffer in RGB format.
- LoadAsRGB(string)
Loads an image from the given file path, applies any necessary path fixes, and returns a new ImageBuffer in RGB format.
- SaveAsBmp(string)
Saves the image to a BMP file at the specified path.
- SaveAsPng(string)
Saves the image to a PNG file at the specified path.