Struct ImageInfo
Represents image metadata including width, height, pixel format, and memory alignment.
Inherited Members
Namespace: FFmpeg.Images
Assembly: FFmpeg.dll
Syntax
public readonly struct ImageInfo
Constructors
View SourceImageInfo(int, int, PixelFormat)
Initializes a new instance of the ImageInfo struct with the specified width, height, and pixel format. Default alignment is set to 1.
Declaration
public ImageInfo(int width, int height, PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The width of the image in pixels. |
| int | height | The height of the image in pixels. |
| PixelFormat | format | The pixel format of the image. |
ImageInfo(int, int, PixelFormat, int)
Represents image metadata including width, height, pixel format, and memory alignment.
Declaration
public ImageInfo(int width, int height, PixelFormat format, int alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | |
| int | height | |
| PixelFormat | format | |
| int | alignment |
Properties
View SourceAlignment
Gets the alignment of the image buffer in memory. Alignment affects the memory padding used to ensure proper alignment for optimized access.
Declaration
public int Alignment { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
BufferSize
Gets the total buffer size required for storing the image in bytes, considering width, height, format, and alignment.
Declaration
public int BufferSize { get; }
Property Value
| Type | Description |
|---|---|
| int |
Format
Gets the pixel format of the image.
Declaration
public PixelFormat Format { get; init; }
Property Value
| Type | Description |
|---|---|
| PixelFormat |
Height
Gets the height of the image in pixels.
Declaration
public int Height { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Planes
Gets the number of planes in the image based on the pixel format. Different pixel formats may split the image data into multiple planes.
Declaration
public int Planes { get; }
Property Value
| Type | Description |
|---|---|
| int |
Width
Gets the width of the image in pixels.
Declaration
public int Width { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceGetLineSize(int)
Gets the size of each line (stride) in bytes for the specified plane. The line size represents the width of the image data for a single row in that plane.
Declaration
public int GetLineSize(int plane)
Parameters
| Type | Name | Description |
|---|---|---|
| int | plane | The index of the plane for which to retrieve the line size. |
Returns
| Type | Description |
|---|---|
| int | The line size in bytes for the specified plane. |
WithAlignment(int)
Creates a new ImageInfo with a modified memory alignment while keeping other properties unchanged.
Declaration
public ImageInfo WithAlignment(int align)
Parameters
| Type | Name | Description |
|---|---|---|
| int | align | The new memory alignment for the image. |
Returns
| Type | Description |
|---|---|
| ImageInfo | A new ImageInfo with the updated alignment. |
WithFormat(PixelFormat)
Creates a new ImageInfo with a modified pixel format while keeping other properties unchanged.
Declaration
public ImageInfo WithFormat(PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The new pixel format of the image. |
Returns
| Type | Description |
|---|---|
| ImageInfo | A new ImageInfo with the updated pixel format. |
WithHeight(int)
Creates a new ImageInfo with a modified height while keeping the other properties unchanged.
Declaration
public ImageInfo WithHeight(int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | height | The new height of the image. |
Returns
| Type | Description |
|---|---|
| ImageInfo | A new ImageInfo with the updated height. |
WithSize(int, int)
Creates a new ImageInfo with a modified size (width and height) while keeping other properties unchanged.
Declaration
public ImageInfo WithSize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The new width of the image. |
| int | height | The new height of the image. |
Returns
| Type | Description |
|---|---|
| ImageInfo | A new ImageInfo with the updated size. |
WithWidth(int)
Creates a new ImageInfo with a modified width while keeping the other properties unchanged.
Declaration
public ImageInfo WithWidth(int width)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The new width of the image. |
Returns
| Type | Description |
|---|---|
| ImageInfo | A new ImageInfo with the updated width. |